Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

propagates csi feature states from supervisor cluster to workload clusters #2493

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

peterochodo
Copy link
Contributor

@peterochodo peterochodo commented May 26, 2022

What this PR does / why we need it

This reconciles the ConfigMap 'vmware-system-csi/csi-feature-states' that is present in the supervisor cluster of tkgs, by propagating its configuration to the value.yaml file used by vsphere-pv-csi addon in workload clusters

Which issue(s) this PR fixes

Fixes #2568

Describe testing done for PR

  • env tests

Release note

package-based-lcm: Sync csi feature states from supervisor cluster to workload cluster

PR Checklist

  • Squash the commits into one or a small number of logical commits
  • Use good commit messages
  • Ensure PR contains terms all contributors can understand and links all contributors can access

Additional information

Special notes for your reviewer

@peterochodo peterochodo requested review from a team as code owners May 26, 2022 02:24
@codecov
Copy link

codecov bot commented May 26, 2022

Codecov Report

Merging #2493 (20ad38d) into main (3083451) will increase coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2493      +/-   ##
==========================================
+ Coverage   42.35%   42.39%   +0.03%     
==========================================
  Files         398      398              
  Lines       39704    39704              
==========================================
+ Hits        16818    16832      +14     
+ Misses      21299    21290       -9     
+ Partials     1587     1582       -5     
Impacted Files Coverage Δ
addons/controllers/clusterbootstrap_controller.go 69.59% <0.00%> (+1.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3083451...20ad38d. Read the comment docs.

@@ -55,6 +55,20 @@ func (r *VSphereCSIConfigReconciler) mapVSphereCSIConfigToDataValuesParavirtual(
dvs.VSpherePVCSI.Namespace = "vmware-system-csi"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: do we want to use constant VSphereCSIFeatureStateNamespace instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

return err
}

for {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: will this cause the infinite loop in some corner cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very unlikely. The function 'decoder.Decode(&rawObj)' invoked by 'getResource(...)', is bound to ultimately return an 'io.EOF' error, or some other kind of error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method same as CreateResources with a check to get resource?

return isFeatureStatesConfigMap(e.ObjectNew) &&
e.ObjectOld.GetResourceVersion() != e.ObjectNew.GetResourceVersion()
},
// Delete is not expected to occur
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: if delete is not expected, do we have any mechanism to prevent that from happening ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deletion prevention of the internal-feature-states ConfigMap is a concern of the supervisor cluster. Tanzu Addons Manager simply observes that ConfigMap. If it is ever deleted, Tanzu Addons Manager will ignore that event and work with the last known settings.

Copy link
Contributor

@vijaykatam vijaykatam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look fine to me. Please fill out PR template (add fixes issue and release note for tracking)before this PR can be merged.

return err
}

for {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method same as CreateResources with a check to get resource?

if !apierrors.IsNotFound(err) {
return nil, errors.Errorf("Error reading configmap '%s/%s': %v", key.Namespace, key.Name, err)
}
dvs.VSpherePVCSI.FeatureStates = nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Don't have to set nil as ytt check for empty map is same as checking for nil

VSphereCSIResizerTimeout = "300s"
VSphereCSIMinDeploymentReplicas = 1
VSphereCSIMaxDeploymentReplicas = 3
VSphereCSIFeatureStateNamespace = VSphereSystemCSINamepace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why define another constant pointing to "vmware-system-csi"?

@vijaykatam
Copy link
Contributor

@peterochodo I filled out the PR template for you. Please follow this in the future if PR needs to be merged.

@vijaykatam vijaykatam added the ok-to-merge PRs should be labelled with this before merging label Jun 7, 2022
@vijaykatam vijaykatam merged commit 1686a44 into vmware-tanzu:main Jun 7, 2022
ankeesler pushed a commit to ankeesler/tanzu-framework that referenced this pull request Jun 14, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
cla-not-required ok-to-merge PRs should be labelled with this before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VsphereCSIConfigController should sync featurestate configs from supervisor cluster to workload cluster
4 participants