apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this name: "[TechPreviewNoUpgrade] Infrastructure" crd: 0000_10_config-operator_01_infrastructure-TechPreviewNoUpgrade.crd.yaml 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: {} onUpdate: - name: Status Should contain default fields initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: {} status: {} updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: {} status: {} expected: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: {} status: cpuPartitioning: None infrastructureTopology: HighlyAvailable controlPlaneTopology: HighlyAvailable - name: Status update cpuPartitioning should fail validation check initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: {} status: cpuPartitioning: None updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: {} status: cpuPartitioning: "Invalid" expectedStatusError: 'status.cpuPartitioning: Unsupported value: "Invalid": supported values: "None", "AllNodes"' - name: Should set load balancer type to OpenShiftManagedDefault if not specified initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: baremetal: {} type: BareMetal updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: baremetal: {} type: BareMetal status: platform: BareMetal platformStatus: baremetal: {} type: BareMetal expected: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: baremetal: {} type: BareMetal status: controlPlaneTopology: HighlyAvailable cpuPartitioning: None infrastructureTopology: HighlyAvailable platform: BareMetal platformStatus: baremetal: loadBalancer: type: OpenShiftManagedDefault type: BareMetal - name: Should be able to override the default load balancer with a valid value initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: baremetal: {} type: BareMetal updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: baremetal: {} type: BareMetal status: platform: BareMetal platformStatus: baremetal: loadBalancer: type: UserManaged type: BareMetal expected: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: baremetal: {} type: BareMetal status: controlPlaneTopology: HighlyAvailable cpuPartitioning: None infrastructureTopology: HighlyAvailable platform: BareMetal platformStatus: baremetal: loadBalancer: type: UserManaged type: BareMetal - name: Should not allow changing the immutable load balancer type field initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: baremetal: {} type: BareMetal status: controlPlaneTopology: HighlyAvailable infrastructureTopology: HighlyAvailable platform: BareMetal platformStatus: baremetal: loadBalancer: type: OpenShiftManagedDefault type: BareMetal updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: type: BareMetal baremetal: {} status: controlPlaneTopology: HighlyAvailable infrastructureTopology: HighlyAvailable platform: BareMetal platformStatus: baremetal: loadBalancer: type: UserManaged type: BareMetal expectedStatusError: "status.platformStatus.baremetal.loadBalancer.type: Invalid value: \"string\": type is immutable once set" - name: Should not allow removing the immutable load balancer type field that was initially set initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: baremetal: {} type: BareMetal status: controlPlaneTopology: HighlyAvailable infrastructureTopology: HighlyAvailable platform: BareMetal platformStatus: baremetal: loadBalancer: type: UserManaged type: BareMetal updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: type: BareMetal baremetal: {} status: controlPlaneTopology: HighlyAvailable infrastructureTopology: HighlyAvailable platform: BareMetal platformStatus: baremetal: {} type: BareMetal expectedStatusError: "status.platformStatus.baremetal.loadBalancer.type: Invalid value: \"string\": type is immutable once set" - name: Should not allow setting the load balancer type to a wrong value initial: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: baremetal: {} type: BareMetal updated: | apiVersion: config.openshift.io/v1 kind: Infrastructure spec: platformSpec: baremetal: {} type: BareMetal status: platform: BareMetal platformStatus: baremetal: loadBalancer: type: FooBar type: BareMetal expectedStatusError: "status.platformStatus.baremetal.loadBalancer.type: Unsupported value: \"FooBar\": supported values: \"OpenShiftManagedDefault\", \"UserManaged\""