Skip to content

Commit ed1ace3

Browse files
committed
Modified parent logic to not check size, but only changes in existence, and other review suggestions.
1 parent 09e2b6d commit ed1ace3

52 files changed

Lines changed: 438 additions & 332 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config/v1/tests/infrastructures.config.openshift.io/VSphereMultiVCenterDay2.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ tests:
386386
- network1
387387
resourcePool: /DC1/host/cluster1/Resources
388388
zone: zone1
389-
expectedError: "vcenters must have at least 1 item"
389+
expectedError: "spec.platformSpec.vsphere.vcenters in body should have at least 1 items"
390390
- name: Should be able to update existing vcenter details without changing vcenter count
391391
initial: |
392392
apiVersion: config.openshift.io/v1
@@ -720,7 +720,7 @@ tests:
720720
- network1
721721
resourcePool: /DC1/host/cluster1/Resources
722722
zone: zone1
723-
expectedError: "vcenters must have at least 1 item"
723+
expectedError: "spec.platformSpec.vsphere.vcenters in body should have at least 1 items"
724724
- name: Should not be able to remove vcenters field entirely once set
725725
initial: |
726726
apiVersion: config.openshift.io/v1

config/v1/types_infrastructure.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,8 @@ type ExternalPlatformSpec struct {
295295
// PlatformSpec holds the desired state specific to the underlying infrastructure provider
296296
// of the current cluster. Since these are used at spec-level for the underlying cluster, it
297297
// is supposed that only one of the spec structs is set.
298-
// +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"
299-
// +openshift:validation:FeatureGateAwareXValidation:featureGate=VSphereMultiVCenterDay2,rule="has(oldSelf.vsphere) && has(oldSelf.vsphere.vcenters) ? (has(self.vsphere) && has(self.vsphere.vcenters) && size(self.vsphere.vcenters) > 0) : true",message="vcenters is required once set and must have at least 1 item"
300-
// +openshift:validation:FeatureGateAwareXValidation:featureGate=VSphereMultiVCenterDay2,rule="!has(oldSelf.vsphere) && has(self.vsphere) && has(self.vsphere.vcenters) ? size(self.vsphere.vcenters) > 0 : true",message="vcenters must have at least 1 item when initially configured"
298+
// +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"
299+
// +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"
301300
type PlatformSpec struct {
302301
// type is the underlying infrastructure provider for the cluster. This
303302
// value controls whether infrastructure automation such as service load
@@ -1645,19 +1644,20 @@ type VSpherePlatformNodeNetworking struct {
16451644
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.ingressIPs) || has(self.ingressIPs)",message="ingressIPs list is required once set"
16461645
type VSpherePlatformSpec struct {
16471646
// vcenters holds the connection details for services to communicate with vCenter.
1648-
// Currently, only a single vCenter is supported, but in tech preview 3 vCenters are supported.
1647+
// Currently, up to 3 vCenters are supported.
16491648
// Once the cluster has been installed, you are unable to change the current number of defined
1650-
// vCenters except in the case where the cluster has been upgraded from a version of OpenShift
1651-
// where the vsphere platform spec was not present. You may make modifications to the existing
1649+
// vCenters except when 1.) the cluster has been upgraded from a version of OpenShift
1650+
// where the vsphere platform spec was not present or 2.) in TechPreview you are able to add and
1651+
// remove vCenters but may not remove all vCenters. You may make modifications to the existing
16521652
// vCenters that are defined in the vcenters list in order to match with any added or modified
16531653
// failure domains.
16541654
// ---
16551655
// + If VCenters is not defined use the existing cloud-config configmap defined
16561656
// + in openshift-config.
1657-
// +kubebuilder:validation:MinItems=0
1657+
// +kubebuilder:validation:MinItems=1
16581658
// +kubebuilder:validation:MaxItems=3
16591659
// +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"
1660-
// +openshift:validation:FeatureGateAwareXValidation:featureGate=VSphereMultiVCenterDay2,rule="size(self) != size(oldSelf) ? size(self) > 0 : true",message="vcenters must have at least 1 item"
1660+
// +openshift:validation:FeatureGateAwareXValidation:featureGate=VSphereMultiVCenterDay2,rule="true",message=""
16611661
// +listType=atomic
16621662
// +optional
16631663
VCenters []VSpherePlatformVCenterSpec `json:"vcenters,omitempty"`

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-CustomNoUpgrade.crd.yaml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,10 +1031,11 @@ spec:
10311031
vcenters:
10321032
description: |-
10331033
vcenters holds the connection details for services to communicate with vCenter.
1034-
Currently, only a single vCenter is supported, but in tech preview 3 vCenters are supported.
1034+
Currently, up to 3 vCenters are supported.
10351035
Once the cluster has been installed, you are unable to change the current number of defined
1036-
vCenters except in the case where the cluster has been upgraded from a version of OpenShift
1037-
where the vsphere platform spec was not present. You may make modifications to the existing
1036+
vCenters except when 1.) the cluster has been upgraded from a version of OpenShift
1037+
where the vsphere platform spec was not present or 2.) in TechPreview you are able to add and
1038+
remove vCenters but may not remove all vCenters. You may make modifications to the existing
10381039
vCenters that are defined in the vcenters list in order to match with any added or modified
10391040
failure domains.
10401041
items:
@@ -1079,12 +1080,11 @@ spec:
10791080
- server
10801081
type: object
10811082
maxItems: 3
1082-
minItems: 0
1083+
minItems: 1
10831084
type: array
10841085
x-kubernetes-list-type: atomic
10851086
x-kubernetes-validations:
1086-
- message: vcenters must have at least 1 item
1087-
rule: 'size(self) != size(oldSelf) ? size(self) > 0 : true'
1087+
- rule: "true"
10881088
type: object
10891089
x-kubernetes-validations:
10901090
- message: apiServerInternalIPs list is required once set
@@ -1093,14 +1093,9 @@ spec:
10931093
rule: '!has(oldSelf.ingressIPs) || has(self.ingressIPs)'
10941094
type: object
10951095
x-kubernetes-validations:
1096-
- message: vcenters is required once set and must have at least 1
1097-
item
1098-
rule: 'has(oldSelf.vsphere) && has(oldSelf.vsphere.vcenters) ? (has(self.vsphere)
1099-
&& has(self.vsphere.vcenters) && size(self.vsphere.vcenters) >
1100-
0) : true'
1101-
- message: vcenters must have at least 1 item when initially configured
1102-
rule: '!has(oldSelf.vsphere) && has(self.vsphere) && has(self.vsphere.vcenters)
1103-
? size(self.vsphere.vcenters) > 0 : true'
1096+
- message: vcenters is required once set and cannot be removed
1097+
rule: 'oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue()
1098+
: true'
11041099
type: object
11051100
status:
11061101
description: status holds observed values from the cluster. They may not

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-Default.crd.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -965,10 +965,11 @@ spec:
965965
vcenters:
966966
description: |-
967967
vcenters holds the connection details for services to communicate with vCenter.
968-
Currently, only a single vCenter is supported, but in tech preview 3 vCenters are supported.
968+
Currently, up to 3 vCenters are supported.
969969
Once the cluster has been installed, you are unable to change the current number of defined
970-
vCenters except in the case where the cluster has been upgraded from a version of OpenShift
971-
where the vsphere platform spec was not present. You may make modifications to the existing
970+
vCenters except when 1.) the cluster has been upgraded from a version of OpenShift
971+
where the vsphere platform spec was not present or 2.) in TechPreview you are able to add and
972+
remove vCenters but may not remove all vCenters. You may make modifications to the existing
972973
vCenters that are defined in the vcenters list in order to match with any added or modified
973974
failure domains.
974975
items:
@@ -1013,7 +1014,7 @@ spec:
10131014
- server
10141015
type: object
10151016
maxItems: 3
1016-
minItems: 0
1017+
minItems: 1
10171018
type: array
10181019
x-kubernetes-list-type: atomic
10191020
x-kubernetes-validations:
@@ -1029,8 +1030,8 @@ spec:
10291030
type: object
10301031
x-kubernetes-validations:
10311032
- message: vcenters can have at most 1 item when configured post-install
1032-
rule: '!has(oldSelf.vsphere) && has(self.vsphere) && has(self.vsphere.vcenters)
1033-
? size(self.vsphere.vcenters) < 2 : true'
1033+
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
1034+
&& size(self.vsphere.vcenters) < 2) : true'
10341035
type: object
10351036
status:
10361037
description: status holds observed values from the cluster. They may not

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-DevPreviewNoUpgrade.crd.yaml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,10 +1031,11 @@ spec:
10311031
vcenters:
10321032
description: |-
10331033
vcenters holds the connection details for services to communicate with vCenter.
1034-
Currently, only a single vCenter is supported, but in tech preview 3 vCenters are supported.
1034+
Currently, up to 3 vCenters are supported.
10351035
Once the cluster has been installed, you are unable to change the current number of defined
1036-
vCenters except in the case where the cluster has been upgraded from a version of OpenShift
1037-
where the vsphere platform spec was not present. You may make modifications to the existing
1036+
vCenters except when 1.) the cluster has been upgraded from a version of OpenShift
1037+
where the vsphere platform spec was not present or 2.) in TechPreview you are able to add and
1038+
remove vCenters but may not remove all vCenters. You may make modifications to the existing
10381039
vCenters that are defined in the vcenters list in order to match with any added or modified
10391040
failure domains.
10401041
items:
@@ -1079,12 +1080,11 @@ spec:
10791080
- server
10801081
type: object
10811082
maxItems: 3
1082-
minItems: 0
1083+
minItems: 1
10831084
type: array
10841085
x-kubernetes-list-type: atomic
10851086
x-kubernetes-validations:
1086-
- message: vcenters must have at least 1 item
1087-
rule: 'size(self) != size(oldSelf) ? size(self) > 0 : true'
1087+
- rule: "true"
10881088
type: object
10891089
x-kubernetes-validations:
10901090
- message: apiServerInternalIPs list is required once set
@@ -1093,14 +1093,9 @@ spec:
10931093
rule: '!has(oldSelf.ingressIPs) || has(self.ingressIPs)'
10941094
type: object
10951095
x-kubernetes-validations:
1096-
- message: vcenters is required once set and must have at least 1
1097-
item
1098-
rule: 'has(oldSelf.vsphere) && has(oldSelf.vsphere.vcenters) ? (has(self.vsphere)
1099-
&& has(self.vsphere.vcenters) && size(self.vsphere.vcenters) >
1100-
0) : true'
1101-
- message: vcenters must have at least 1 item when initially configured
1102-
rule: '!has(oldSelf.vsphere) && has(self.vsphere) && has(self.vsphere.vcenters)
1103-
? size(self.vsphere.vcenters) > 0 : true'
1096+
- message: vcenters is required once set and cannot be removed
1097+
rule: 'oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue()
1098+
: true'
11041099
type: object
11051100
status:
11061101
description: status holds observed values from the cluster. They may not

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-OKD.crd.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -965,10 +965,11 @@ spec:
965965
vcenters:
966966
description: |-
967967
vcenters holds the connection details for services to communicate with vCenter.
968-
Currently, only a single vCenter is supported, but in tech preview 3 vCenters are supported.
968+
Currently, up to 3 vCenters are supported.
969969
Once the cluster has been installed, you are unable to change the current number of defined
970-
vCenters except in the case where the cluster has been upgraded from a version of OpenShift
971-
where the vsphere platform spec was not present. You may make modifications to the existing
970+
vCenters except when 1.) the cluster has been upgraded from a version of OpenShift
971+
where the vsphere platform spec was not present or 2.) in TechPreview you are able to add and
972+
remove vCenters but may not remove all vCenters. You may make modifications to the existing
972973
vCenters that are defined in the vcenters list in order to match with any added or modified
973974
failure domains.
974975
items:
@@ -1013,7 +1014,7 @@ spec:
10131014
- server
10141015
type: object
10151016
maxItems: 3
1016-
minItems: 0
1017+
minItems: 1
10171018
type: array
10181019
x-kubernetes-list-type: atomic
10191020
x-kubernetes-validations:
@@ -1029,8 +1030,8 @@ spec:
10291030
type: object
10301031
x-kubernetes-validations:
10311032
- message: vcenters can have at most 1 item when configured post-install
1032-
rule: '!has(oldSelf.vsphere) && has(self.vsphere) && has(self.vsphere.vcenters)
1033-
? size(self.vsphere.vcenters) < 2 : true'
1033+
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
1034+
&& size(self.vsphere.vcenters) < 2) : true'
10341035
type: object
10351036
status:
10361037
description: status holds observed values from the cluster. They may not

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-TechPreviewNoUpgrade.crd.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,10 +1031,11 @@ spec:
10311031
vcenters:
10321032
description: |-
10331033
vcenters holds the connection details for services to communicate with vCenter.
1034-
Currently, only a single vCenter is supported, but in tech preview 3 vCenters are supported.
1034+
Currently, up to 3 vCenters are supported.
10351035
Once the cluster has been installed, you are unable to change the current number of defined
1036-
vCenters except in the case where the cluster has been upgraded from a version of OpenShift
1037-
where the vsphere platform spec was not present. You may make modifications to the existing
1036+
vCenters except when 1.) the cluster has been upgraded from a version of OpenShift
1037+
where the vsphere platform spec was not present or 2.) in TechPreview you are able to add and
1038+
remove vCenters but may not remove all vCenters. You may make modifications to the existing
10381039
vCenters that are defined in the vcenters list in order to match with any added or modified
10391040
failure domains.
10401041
items:
@@ -1079,7 +1080,7 @@ spec:
10791080
- server
10801081
type: object
10811082
maxItems: 3
1082-
minItems: 0
1083+
minItems: 1
10831084
type: array
10841085
x-kubernetes-list-type: atomic
10851086
x-kubernetes-validations:
@@ -1095,8 +1096,8 @@ spec:
10951096
type: object
10961097
x-kubernetes-validations:
10971098
- message: vcenters can have at most 1 item when configured post-install
1098-
rule: '!has(oldSelf.vsphere) && has(self.vsphere) && has(self.vsphere.vcenters)
1099-
? size(self.vsphere.vcenters) < 2 : true'
1099+
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
1100+
&& size(self.vsphere.vcenters) < 2) : true'
11001101
type: object
11011102
status:
11021103
description: status holds observed values from the cluster. They may not

config/v1/zz_generated.featuregated-crd-manifests/infrastructures.config.openshift.io/AAA_ungated.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -946,10 +946,11 @@ spec:
946946
vcenters:
947947
description: |-
948948
vcenters holds the connection details for services to communicate with vCenter.
949-
Currently, only a single vCenter is supported, but in tech preview 3 vCenters are supported.
949+
Currently, up to 3 vCenters are supported.
950950
Once the cluster has been installed, you are unable to change the current number of defined
951-
vCenters except in the case where the cluster has been upgraded from a version of OpenShift
952-
where the vsphere platform spec was not present. You may make modifications to the existing
951+
vCenters except when 1.) the cluster has been upgraded from a version of OpenShift
952+
where the vsphere platform spec was not present or 2.) in TechPreview you are able to add and
953+
remove vCenters but may not remove all vCenters. You may make modifications to the existing
953954
vCenters that are defined in the vcenters list in order to match with any added or modified
954955
failure domains.
955956
items:
@@ -990,7 +991,7 @@ spec:
990991
- server
991992
type: object
992993
maxItems: 3
993-
minItems: 0
994+
minItems: 1
994995
type: array
995996
x-kubernetes-list-type: atomic
996997
x-kubernetes-validations:
@@ -1006,8 +1007,8 @@ spec:
10061007
type: object
10071008
x-kubernetes-validations:
10081009
- message: vcenters can have at most 1 item when configured post-install
1009-
rule: '!has(oldSelf.vsphere) && has(self.vsphere) && has(self.vsphere.vcenters)
1010-
? size(self.vsphere.vcenters) < 2 : true'
1010+
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
1011+
&& size(self.vsphere.vcenters) < 2) : true'
10111012
type: object
10121013
status:
10131014
description: status holds observed values from the cluster. They may not

0 commit comments

Comments
 (0)