-
Notifications
You must be signed in to change notification settings - Fork 605
SPLAT-2649: Added vSphere Day 2 logic to CRDs #2784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,7 +295,8 @@ type ExternalPlatformSpec struct { | |
| // PlatformSpec holds the desired state specific to the underlying infrastructure provider | ||
| // of the current cluster. Since these are used at spec-level for the underlying cluster, it | ||
| // is supposed that only one of the spec structs is set. | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.vsphere) && has(self.vsphere) ? size(self.vsphere.vcenters) < 2 : true",message="vcenters can have at most 1 item when configured post-install" | ||
| // +openshift:validation:FeatureGateAwareXValidation:featureGate="",rule="!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters) && size(self.vsphere.vcenters) < 2) : true",message="vcenters can have at most 1 item when configured post-install" | ||
| // +openshift:validation:FeatureGateAwareXValidation:featureGate=VSphereMultiVCenterDay2,rule="oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue() : true",message="vcenters is required once set and cannot be removed" | ||
| type PlatformSpec struct { | ||
| // type is the underlying infrastructure provider for the cluster. This | ||
| // value controls whether infrastructure automation such as service load | ||
|
|
@@ -1641,21 +1642,22 @@ type VSpherePlatformNodeNetworking struct { | |
| // use these fields for configuration. | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.apiServerInternalIPs) || has(self.apiServerInternalIPs)",message="apiServerInternalIPs list is required once set" | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.ingressIPs) || has(self.ingressIPs)",message="ingressIPs list is required once set" | ||
| // +kubebuilder:validation:XValidation:rule="!has(oldSelf.vcenters) && has(self.vcenters) ? size(self.vcenters) < 2 : true",message="vcenters can have at most 1 item when configured post-install" | ||
| type VSpherePlatformSpec struct { | ||
| // vcenters holds the connection details for services to communicate with vCenter. | ||
| // Currently, only a single vCenter is supported, but in tech preview 3 vCenters are supported. | ||
| // Currently, up to 3 vCenters are supported. | ||
| // Once the cluster has been installed, you are unable to change the current number of defined | ||
| // vCenters except in the case where the cluster has been upgraded from a version of OpenShift | ||
| // where the vsphere platform spec was not present. You may make modifications to the existing | ||
| // vCenters except when 1.) the cluster has been upgraded from a version of OpenShift | ||
| // where the vsphere platform spec was not present or 2.) in TechPreview you are able to add and | ||
| // remove vCenters but may not remove all vCenters. You may make modifications to the existing | ||
| // vCenters that are defined in the vcenters list in order to match with any added or modified | ||
| // failure domains. | ||
| // --- | ||
| // + If VCenters is not defined use the existing cloud-config configmap defined | ||
| // + in openshift-config. | ||
| // +kubebuilder:validation:MinItems=0 | ||
| // +kubebuilder:validation:MinItems=1 | ||
| // +kubebuilder:validation:MaxItems=3 | ||
| // +kubebuilder:validation:XValidation:rule="size(self) != size(oldSelf) ? size(oldSelf) == 0 && size(self) < 2 : true",message="vcenters cannot be added or removed once set" | ||
| // +openshift:validation:FeatureGateAwareXValidation:featureGate="",rule="size(self) != size(oldSelf) ? size(oldSelf) == 0 && size(self) < 2 : true",message="vcenters cannot be added or removed once set" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I completely change the configuration of the vcenter, but keep the number the same, is that ok? Effectively like adding an item to the list, then removing the old item, but in one transaction?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. that would be be ok now going forward since we'll be cleaning up older configs from the cloud config via the other PRs; however, the older releases this would not be allowed. Its the configuration of vcenters in the ini / yaml file that we are protecting. Older cluster installs (before multi vcenter was introduced) had ini files and that only allowed 1 vcenter. Newer installs now leverage YAML cloud config and we can configure more than 1. So even replacing the existing one w/ a new one will invalidate the INI file and cluster will be in bad shape.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In another comment, you mention backporting - what is potentially being backported here? Do we need to account for this difference in older vs newer clusters?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tldrwe are backporting the ability to allow adding vcenters day 2. Many customers want to migrate to a new vcenter or add new ones but not reinstall to get multi vcenter support. This involves feature gate backport and all changes related to this feature. The long story:Many of the checks I originally had in place account for all past states of clusters. Back in the beginning, the infrastructure spec did not have a vsphere.vcenters field. So any super old cluster will not have this. That is why we check for if initial did not exist and how we only allow it adding 1 MAX. With our feature gate change, we want to allow them to add 1 or more to the vcenters field. We will never allow the field returning to zero or not set. Joel is recommending we change this field to be max of 1. This is because once the field is set, the minimum value should be 1 forever. A cluster with no vcenters configured is invalid and will break. For older clusters where vsphere.vcenters is not configured, we just honor whats currently configured in the old school cloud config ini file. Another good point Joel made was a situation where user has 1 vcenter defined and tries to replace it w/ a new one. This means size is still 1 after the update. In this case, we would need validation to make sure that the failure domains defined have a vcenter configured that matches its config. We do have a few places that validate this. I am not sure if CEL is the best place for this. Not sure who owns validating the infrastructure spec from a hook perspective, but we do have the storage vsphereproblemdetector who does some validations of cluster config. Lastly, once this is backported and functionality is tested and approved, we want to GA all the way back so customers can now migrate their old clusters to new clusters or add additional vcenters to the mix. In my mind, the featureGate="" validations would be removed and we'd only be keeping the ones where the feature gate exists (since when its GA, the newer fields will be the only one exercised). I originally set up a meeting with Joel for yesterday but he was out. We can set up a meeting with the three of us next week to further discuss. I wanted to do that to make sure everything is clear w/o reviews taking a long time. Let me know your thoughts. Thanks!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A meeting seems like a good way to make sure we are on the same page here. The minimum of 1 change seems fine to me.
If you are wanting to make sure that all old configurations are represented in the new list, you should be able to enforce that via CEL with something like: |
||
| // +openshift:validation:FeatureGateAwareXValidation:featureGate=VSphereMultiVCenterDay2,rule="true",message="" | ||
| // +listType=atomic | ||
| // +optional | ||
| VCenters []VSpherePlatformVCenterSpec `json:"vcenters,omitempty"` | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When making this change, let's make sure we add some test cases similar to this
api/example/v1/tests/stableconfigtypes.example.openshift.io/AAA_ungated.yaml
Lines 902 to 964 in 464776f
Having tests like that will help verify that this validation change is ratcheting successfully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do another pass at the tests. I thought they were covering what we expected. If you are seeing any missing, that would help me narrow down the scope. Is the concern that we need to add more "AAA_ungated" tests? I always assumed those were the existing tests for the type to make sure current functionality does not break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the validation change is ungated, more
AAA_ungatedtests would be what I'm looking for.Specifically these scenarios:
when
vcenters: []is explicitly set.