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
158 changes: 79 additions & 79 deletions config/v1/tests/infrastructures.config.openshift.io/AAA_ungated.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "Infrastructure"
crdName: infrastructures.config.openshift.io
featureGates:
- MutableTopology
tests:
onCreate:
- name: Should be able to create a minimal Infrastructure without controlPlaneTopology in spec
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
- name: Should be able to create Infrastructure with spec controlPlaneTopology set to HighlyAvailable
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: HighlyAvailable
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: HighlyAvailable
- name: Should be able to create Infrastructure with spec controlPlaneTopology set to SingleReplica
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: SingleReplica
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: SingleReplica
- name: Should not allow creating Infrastructure with spec controlPlaneTopology set to an invalid value
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: InvalidValue
expectedError: 'spec.controlPlaneTopology: Unsupported value: "InvalidValue": supported values: "HighlyAvailable", "SingleReplica"'
- name: Should not allow creating Infrastructure with spec controlPlaneTopology set to External
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: External
expectedError: 'spec.controlPlaneTopology: Unsupported value: "External": supported values: "HighlyAvailable", "SingleReplica"'
- name: Should not allow creating Infrastructure with spec controlPlaneTopology set to DualReplica
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: DualReplica
expectedError: 'spec.controlPlaneTopology: Unsupported value: "DualReplica": supported values: "HighlyAvailable", "SingleReplica"'
- name: Should not allow creating Infrastructure with spec controlPlaneTopology set to HighlyAvailableArbiter
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: HighlyAvailableArbiter
expectedError: 'spec.controlPlaneTopology: Unsupported value: "HighlyAvailableArbiter": supported values: "HighlyAvailable", "SingleReplica"'
onUpdate:
- name: Should allow updating spec controlPlaneTopology from HighlyAvailable to SingleReplica
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: HighlyAvailable
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: SingleReplica
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: SingleReplica
- name: Should allow updating spec controlPlaneTopology from SingleReplica to HighlyAvailable
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: SingleReplica
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: HighlyAvailable
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: HighlyAvailable
- name: Should allow removing spec controlPlaneTopology
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: HighlyAvailable
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
- name: Should not allow updating spec controlPlaneTopology to an invalid value
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: HighlyAvailable
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
controlPlaneTopology: InvalidValue
expectedError: 'spec.controlPlaneTopology: Unsupported value: "InvalidValue": supported values: "HighlyAvailable", "SingleReplica"'
15 changes: 15 additions & 0 deletions config/v1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ type InfrastructureSpec struct {
// platformSpec holds desired information specific to the underlying
// infrastructure provider.
PlatformSpec PlatformSpec `json:"platformSpec,omitempty"`

// controlPlaneTopology expresses the desired topology configuration for control nodes.
//
// When status.controlPlaneTopology is 'SingleReplica' and spec.controlPlaneTopology is set to 'HighlyAvailable',
// a transition will be triggered to reconfigure the cluster from SingleReplica to HighlyAvailable.
//
// When left blank or status.controlPlaneTopology and spec.controlPlaneTopology are the same value,
// no changes are required and no transitions will be triggered.
//
// This value should only ever be set to SingleReplica if status.controlPlaneTopology is also set to SingleReplica.
//
// +openshift:enable:FeatureGate=MutableTopology
// +kubebuilder:validation:Enum=HighlyAvailable;SingleReplica
// +optional
ControlPlaneTopology TopologyMode `json:"controlPlaneTopology,omitempty"`
}

// InfrastructureStatus describes the infrastructure the cluster is leveraging.
Expand Down
2 changes: 1 addition & 1 deletion config/v1/types_infrastructure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

const (
infraCRDDefaultFilePath = "0000_10_config-operator_01_infrastructures-Default.crd.yaml"
infraCRDTestPreviewFilePath = "0000_10_config-operator_01_infrastructures-TechPreviewNoUpgrade.crd.yaml"
infraCRDTestPreviewFilePath = "0000_10_config-operator_01_infrastructures-SelfManagedHA-TechPreviewNoUpgrade.crd.yaml"
)

// TestInfrastructureStatusDefault verifies that the infrastructure CR status does not have default value
Expand Down
Loading