Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: "Infrastructure"
crdName: infrastructures.config.openshift.io
featureGates:
- -AWSClusterHostedDNS
- -VSphereMultiVCenterDay2
tests:
onCreate:
- name: Should be able to create a minimal Infrastructure
Expand Down Expand Up @@ -1884,6 +1883,8 @@ tests:
initialCRDPatches:
- op: remove
path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/platformSpec/properties/vsphere/properties/vcenters/minItems
- op: remove
path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/platformSpec/properties/vsphere/x-kubernetes-validations/0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: patching by array index (x-kubernetes-validations/0) is fragile; if the rule order changes in a future generation, this silently patches out the wrong rule. Not a blocker since it matches the current generated output, but worth noting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i agree. i wasn't sure of a way to patch it out for ratcheting tests. Is there something better i can do for this test?

initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
Expand Down
10 changes: 4 additions & 6 deletions config/v1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -1722,12 +1722,10 @@ type VSpherePlatformNodeNetworking struct {
type VSpherePlatformSpec struct {
// vcenters holds the connection details for services to communicate with vCenter.
// Up to 3 vCenters are supported.
// Once the cluster has been installed, you are unable to change the current number of defined
// 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.
// After installation, you can add or change vCenters, or remove some of them, but you must keep

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The godoc describes that users can "add or change vCenters, or remove some of them" but does not mention that these are mutually exclusive per-update operations. The FeatureGateAwareXValidation rules on lines 1709-1710 enforce that adds and removes cannot happen in the same update, e.g. [A,B] -> [A,C] (swap B for C) is rejected with "Cannot add and remove vCenters at the same time".

Consider adding something like: "Adding and removing vCenters must be done as separate updates."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i'll make that change.

// at least one and may not add and remove vCenters during the same update. 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing space after //: //modified should be // modified. This propagates to all generated CRD descriptions and swagger docs.

// ---
// + If VCenters is not defined use the existing cloud-config configmap defined
// + in openshift-config.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -970,12 +970,10 @@ spec:
description: |-
vcenters holds the connection details for services to communicate with vCenter.
Up to 3 vCenters are supported.
Once the cluster has been installed, you are unable to change the current number of defined
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.
After installation, you can add or change vCenters, or remove some of them, but you must keep
at least one and may not add and remove vCenters during the same update. 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.
items:
description: |-
VSpherePlatformVCenterSpec stores the vCenter connection fields.
Expand Down Expand Up @@ -1022,19 +1020,30 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: Cannot add and remove vCenters at the same time
rule: 'size(self) >= size(oldSelf) ? oldSelf.all(x, self.exists(y,
y.server == x.server)) : true'
- message: Cannot add and remove vCenters at the same time
rule: 'size(self) < size(oldSelf) ? self.all(x, oldSelf.exists(y,
y.server == x.server)) : true'
- message: vcenters must have unique server values
rule: self.all(x, self.exists_one(y, y.server == x.server))
type: object
x-kubernetes-validations:
- message: all failure domains must have a corresponding vCenter
entry
rule: '!has(self.failureDomains) || size(self.failureDomains)
== 0 || (has(self.vcenters) && self.failureDomains.all(fd,
self.vcenters.exists(vc, vc.server == fd.server)))'
- message: apiServerInternalIPs list is required once set
rule: '!has(oldSelf.apiServerInternalIPs) || has(self.apiServerInternalIPs)'
- message: ingressIPs list is required once set
rule: '!has(oldSelf.ingressIPs) || has(self.ingressIPs)'
type: object
x-kubernetes-validations:
- message: vcenters can have at most 1 item when configured post-install
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
&& size(self.vsphere.vcenters) < 2) : true'
- message: vcenters is required once set and cannot be removed
rule: 'oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue()
: true'
type: object
status:
description: status holds observed values from the cluster. They may not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1050,12 +1050,10 @@ spec:
description: |-
vcenters holds the connection details for services to communicate with vCenter.
Up to 3 vCenters are supported.
Once the cluster has been installed, you are unable to change the current number of defined
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.
After installation, you can add or change vCenters, or remove some of them, but you must keep
at least one and may not add and remove vCenters during the same update. 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.
items:
description: |-
VSpherePlatformVCenterSpec stores the vCenter connection fields.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1035,12 +1035,10 @@ spec:
description: |-
vcenters holds the connection details for services to communicate with vCenter.
Up to 3 vCenters are supported.
Once the cluster has been installed, you are unable to change the current number of defined
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.
After installation, you can add or change vCenters, or remove some of them, but you must keep
at least one and may not add and remove vCenters during the same update. 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.
items:
description: |-
VSpherePlatformVCenterSpec stores the vCenter connection fields.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -970,12 +970,10 @@ spec:
description: |-
vcenters holds the connection details for services to communicate with vCenter.
Up to 3 vCenters are supported.
Once the cluster has been installed, you are unable to change the current number of defined
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.
After installation, you can add or change vCenters, or remove some of them, but you must keep
at least one and may not add and remove vCenters during the same update. 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.
items:
description: |-
VSpherePlatformVCenterSpec stores the vCenter connection fields.
Expand Down Expand Up @@ -1022,19 +1020,30 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: Cannot add and remove vCenters at the same time
rule: 'size(self) >= size(oldSelf) ? oldSelf.all(x, self.exists(y,
y.server == x.server)) : true'
- message: Cannot add and remove vCenters at the same time
rule: 'size(self) < size(oldSelf) ? self.all(x, oldSelf.exists(y,
y.server == x.server)) : true'
- message: vcenters must have unique server values
rule: self.all(x, self.exists_one(y, y.server == x.server))
type: object
x-kubernetes-validations:
- message: all failure domains must have a corresponding vCenter
entry
rule: '!has(self.failureDomains) || size(self.failureDomains)
== 0 || (has(self.vcenters) && self.failureDomains.all(fd,
self.vcenters.exists(vc, vc.server == fd.server)))'
- message: apiServerInternalIPs list is required once set
rule: '!has(oldSelf.apiServerInternalIPs) || has(self.apiServerInternalIPs)'
- message: ingressIPs list is required once set
rule: '!has(oldSelf.ingressIPs) || has(self.ingressIPs)'
type: object
x-kubernetes-validations:
- message: vcenters can have at most 1 item when configured post-install
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
&& size(self.vsphere.vcenters) < 2) : true'
- message: vcenters is required once set and cannot be removed
rule: 'oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue()
: true'
type: object
status:
description: status holds observed values from the cluster. They may not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1050,12 +1050,10 @@ spec:
description: |-
vcenters holds the connection details for services to communicate with vCenter.
Up to 3 vCenters are supported.
Once the cluster has been installed, you are unable to change the current number of defined
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.
After installation, you can add or change vCenters, or remove some of them, but you must keep
at least one and may not add and remove vCenters during the same update. 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.
items:
description: |-
VSpherePlatformVCenterSpec stores the vCenter connection fields.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1050,12 +1050,10 @@ spec:
description: |-
vcenters holds the connection details for services to communicate with vCenter.
Up to 3 vCenters are supported.
Once the cluster has been installed, you are unable to change the current number of defined
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.
After installation, you can add or change vCenters, or remove some of them, but you must keep
at least one and may not add and remove vCenters during the same update. 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.
items:
description: |-
VSpherePlatformVCenterSpec stores the vCenter connection fields.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1036,12 +1036,10 @@ spec:
description: |-
vcenters holds the connection details for services to communicate with vCenter.
Up to 3 vCenters are supported.
Once the cluster has been installed, you are unable to change the current number of defined
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.
After installation, you can add or change vCenters, or remove some of them, but you must keep
at least one and may not add and remove vCenters during the same update. 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.
items:
description: |-
VSpherePlatformVCenterSpec stores the vCenter connection fields.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -951,12 +951,10 @@ spec:
description: |-
vcenters holds the connection details for services to communicate with vCenter.
Up to 3 vCenters are supported.
Once the cluster has been installed, you are unable to change the current number of defined
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.
After installation, you can add or change vCenters, or remove some of them, but you must keep
at least one and may not add and remove vCenters during the same update. 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.
items:
description: |-
VSpherePlatformVCenterSpec stores the vCenter connection fields.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,12 +949,10 @@ spec:
description: |-
vcenters holds the connection details for services to communicate with vCenter.
Up to 3 vCenters are supported.
Once the cluster has been installed, you are unable to change the current number of defined
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.
After installation, you can add or change vCenters, or remove some of them, but you must keep
at least one and may not add and remove vCenters during the same update. 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.
items:
description: |-
VSpherePlatformVCenterSpec stores the vCenter connection fields.
Expand Down
Loading