Skip to content

Commit

Permalink
Created new VSphereMultiVCenters feature gate with vcenter MaxItems t…
Browse files Browse the repository at this point in the history
…o be 3.
  • Loading branch information
vr4manta committed May 7, 2024
1 parent ff71bbd commit 0a0b6fa
Show file tree
Hide file tree
Showing 33 changed files with 4,649 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "Infrastructure"
crdName: infrastructures.config.openshift.io
featureGate: -VSphereMultiVCenters
tests:
onCreate:
- name: Should be able to create a minimal Infrastructure
Expand Down Expand Up @@ -182,6 +183,72 @@ tests:
machineNetworks:
- 192.0.2.1
expectedError: "spec.platformSpec.baremetal.machineNetworks[0]: Invalid value: \"string\": value must be a valid CIDR network address"
- name: Should not be able to pass more than 1 entries to vcenters in the vsphere platform spec
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: VSphere
vsphere:
failureDomains:
- name: generated-failure-domain
region: generated-region
server: server1.dev.cluster.com
topology:
computeCluster: /IBMCloud/host/vcs-8e-workload
datacenter: IBMCloud
datastore: /IBMCloud/datastore/mdcnc-ds-shared
networks:
- ocp-ci-seg-13
resourcePool: /IBMCloud/host/vcs-8e-workload/Resources
template: /IBMCloud/vm/ngirard-dev-rqh5s-rhcos-generated-region-generated-zone
zone: generated-zone
nodeNetworking:
external: {}
internal: {}
vcenters:
- datacenters:
- IBMCloud
port: 443
server: server1.dev.cluster.com
- datacenters:
- IBMCloud2
port: 443
server: server2.dev.cluster.com
# expected: |
# apiVersion: config.openshift.io/v1
# kind: Infrastructure
# spec:
# platformSpec:
# type: VSphere
# vsphere:
# failureDomains:
# - name: generated-failure-domain
# region: generated-region
# server: server1.dev.cluster.com
# topology:
# computeCluster: /IBMCloud/host/vcs-8e-workload
# datacenter: IBMCloud
# datastore: /IBMCloud/datastore/mdcnc-ds-shared
# networks:
# - ocp-ci-seg-13
# resourcePool: /IBMCloud/host/vcs-8e-workload/Resources
# template: /IBMCloud/vm/ngirard-dev-rqh5s-rhcos-generated-region-generated-zone
# zone: generated-zone
# nodeNetworking:
# external: {}
# internal: {}
# vcenters:
# - datacenters:
# - IBMCloud
# port: 443
# server: server1.dev.cluster.com
# - datacenters:
# - IBMCloud2
# port: 443
# server: server2.dev.cluster.com
expectedError: "Too many: 2: must have at most 1 items"
onUpdate:
- name: Should be able to change External platformName from unknown to something else
initial: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "Infrastructure"
crdName: infrastructures.config.openshift.io
featureGate: VSphereMultiVCenters
tests:
onCreate:
- name: Should be able to create a minimal Infrastructure
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {} # No spec is required for a Infrastructure
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
- name: Should be able to pass more than 1 entries to vcenters in the vsphere platform spec
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
cloudConfig:
key: config
name: cloud-provider-config
platformSpec:
type: VSphere
vsphere:
failureDomains:
- name: generated-failure-domain
region: generated-region
server: server1.dev.cluster.com
topology:
computeCluster: /IBMCloud/host/vcs-8e-workload
datacenter: IBMCloud
datastore: /IBMCloud/datastore/mdcnc-ds-shared
networks:
- ocp-ci-seg-13
resourcePool: /IBMCloud/host/vcs-8e-workload/Resources
template: /IBMCloud/vm/ngirard-dev-rqh5s-rhcos-generated-region-generated-zone
zone: generated-zone
nodeNetworking:
external: {}
internal: {}
vcenters:
- datacenters:
- IBMCloud
port: 443
server: server1.dev.cluster.com
- datacenters:
- IBMCloud2
port: 443
server: server2.dev.cluster.com
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
cloudConfig:
key: config
name: cloud-provider-config
platformSpec:
type: VSphere
vsphere:
failureDomains:
- name: generated-failure-domain
region: generated-region
server: server1.dev.cluster.com
topology:
computeCluster: /IBMCloud/host/vcs-8e-workload
datacenter: IBMCloud
datastore: /IBMCloud/datastore/mdcnc-ds-shared
networks:
- ocp-ci-seg-13
resourcePool: /IBMCloud/host/vcs-8e-workload/Resources
template: /IBMCloud/vm/ngirard-dev-rqh5s-rhcos-generated-region-generated-zone
zone: generated-zone
nodeNetworking:
external: {}
internal: {}
vcenters:
- datacenters:
- IBMCloud
port: 443
server: server1.dev.cluster.com
- datacenters:
- IBMCloud2
port: 443
server: server2.dev.cluster.com
onUpdate:
- name: Should be able to set vCenters to multiple
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
cloudConfig:
key: config
name: cloud-provider-config
platformSpec:
type: VSphere
vsphere:
vcenters:
- datacenters:
- IBMCloud
port: 443
server: vcs8e-vc.ocp2.dev.cluster.com
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
cloudConfig:
key: config
name: cloud-provider-config
platformSpec:
type: VSphere
vsphere:
vcenters:
- datacenters:
- IBMCloud
port: 443
server: vcs8e-vc.ocp2.dev.cluster.com
- datacenters:
- IBMCloud
port: 443
server: v8c-2-vcenter.ocp2.dev.cluster.com
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
cloudConfig:
key: config
name: cloud-provider-config
platformSpec:
type: VSphere
vsphere:
vcenters:
- datacenters:
- IBMCloud
port: 443
server: vcs8e-vc.ocp2.dev.cluster.com
- datacenters:
- IBMCloud
port: 443
server: v8c-2-vcenter.ocp2.dev.cluster.com
3 changes: 2 additions & 1 deletion config/v1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,9 @@ type VSpherePlatformSpec struct {
// ---
// + If VCenters is not defined use the existing cloud-config configmap defined
// + in openshift-config.
// +kubebuilder:validation:MaxItems=1
// +kubebuilder:validation:MinItems=0
// +openshift:validation:FeatureGateAwareMaxItems:featureGate="",maxItems=1
// +openshift:validation:FeatureGateAwareMaxItems:featureGate=VSphereMultiVCenters,maxItems=3
// +listType=atomic
// +optional
VCenters []VSpherePlatformVCenterSpec `json:"vcenters,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ spec:
- datacenters
- server
type: object
maxItems: 1
maxItems: 3
minItems: 0
type: array
x-kubernetes-list-type: atomic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ spec:
- datacenters
- server
type: object
maxItems: 1
maxItems: 3
minItems: 0
type: array
x-kubernetes-list-type: atomic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ spec:
- datacenters
- server
type: object
maxItems: 1
maxItems: 3
minItems: 0
type: array
x-kubernetes-list-type: atomic
Expand Down
1 change: 1 addition & 0 deletions config/v1/zz_generated.featuregated-crd-manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ infrastructures.config.openshift.io:
- GCPClusterHostedDNS
- GCPLabelsTags
- VSphereControlPlaneMachineSet
- VSphereMultiVCenters
FilenameOperatorName: config-operator
FilenameOperatorOrdering: "01"
FilenameRunLevel: "0000_10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,6 @@ spec:
- datacenters
- server
type: object
maxItems: 1
minItems: 0
type: array
x-kubernetes-list-type: atomic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,6 @@ spec:
- datacenters
- server
type: object
maxItems: 1
minItems: 0
type: array
x-kubernetes-list-type: atomic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,6 @@ spec:
- datacenters
- server
type: object
maxItems: 1
minItems: 0
type: array
x-kubernetes-list-type: atomic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,6 @@ spec:
- datacenters
- server
type: object
maxItems: 1
minItems: 0
type: array
x-kubernetes-list-type: atomic
Expand Down
Loading

0 comments on commit 0a0b6fa

Please sign in to comment.