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
@@ -0,0 +1,81 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "Infrastructure"
crdName: infrastructures.config.openshift.io
featureGates:
- AdaptableTopology
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 allow controlPlaneTopology value for `Adaptable` on platform None
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: None
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: None
status:
controlPlaneTopology: Adaptable
infrastructureTopology: HighlyAvailable
platform: None
platformStatus:
type: None
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: None
status:
controlPlaneTopology: Adaptable
cpuPartitioning: None
infrastructureTopology: HighlyAvailable
platform: None
platformStatus:
type: None
- name: status should allow infrastructureTopology value for `Adaptable` on platform None
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: None
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: None
status:
controlPlaneTopology: HighlyAvailable
infrastructureTopology: Adaptable
platform: None
platformStatus:
type: None
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: None
status:
controlPlaneTopology: HighlyAvailable
cpuPartitioning: None
infrastructureTopology: Adaptable
platform: None
platformStatus:
type: None
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "Infrastructure"
crdName: infrastructures.config.openshift.io
featureGates:
- DualReplica
- AdaptableTopology
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 allow controlPlaneTopology value for `Adaptable`
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: None
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: None
status:
controlPlaneTopology: Adaptable
infrastructureTopology: HighlyAvailable
platform: None
platformStatus:
type: None
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: None
status:
controlPlaneTopology: Adaptable
cpuPartitioning: None
infrastructureTopology: HighlyAvailable
platform: None
platformStatus:
type: None
- name: status should allow controlPlaneTopology value for `DualReplica`
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
baremetal: {}
type: BareMetal
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: BareMetal
baremetal: {}
status:
controlPlaneTopology: DualReplica
infrastructureTopology: HighlyAvailable
platform: BareMetal
platformStatus:
baremetal:
loadBalancer:
type: OpenShiftManagedDefault
type: BareMetal
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: BareMetal
baremetal: {}
status:
controlPlaneTopology: DualReplica
cpuPartitioning: None
infrastructureTopology: HighlyAvailable
platform: BareMetal
platformStatus:
baremetal:
loadBalancer:
type: OpenShiftManagedDefault
type: BareMetal
- name: should not allow changing infrastructureTopology value to `DualReplica`
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
baremetal: {}
type: BareMetal
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: BareMetal
baremetal: {}
status:
controlPlaneTopology: HighlyAvailable
infrastructureTopology: DualReplica
platform: BareMetal
platformStatus:
baremetal:
loadBalancer:
type: OpenShiftManagedDefault
type: BareMetal
expectedStatusError: 'status.infrastructureTopology: Unsupported value: "DualReplica": supported values: "HighlyAvailable", "SingleReplica"'
9 changes: 8 additions & 1 deletion config/v1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ type InfrastructureStatus struct {
// +kubebuilder:default=HighlyAvailable
// +openshift:validation:FeatureGateAwareEnum:featureGate="",enum=HighlyAvailable;HighlyAvailableArbiter;SingleReplica;External
// +openshift:validation:FeatureGateAwareEnum:featureGate=DualReplica,enum=HighlyAvailable;HighlyAvailableArbiter;SingleReplica;DualReplica;External
// +openshift:validation:FeatureGateAwareEnum:featureGate=AdaptableTopology,enum=HighlyAvailable;HighlyAvailableArbiter;SingleReplica;DualReplica;Adaptable;External
// +openshift:validation:FeatureGateAwareEnum:requiredFeatureGate=DualReplica;AdaptableTopology,enum=HighlyAvailable;HighlyAvailableArbiter;SingleReplica;DualReplica;Adaptable;External
// +optional
ControlPlaneTopology TopologyMode `json:"controlPlaneTopology"`
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Expand All @@ -118,7 +120,8 @@ type InfrastructureStatus struct {
// and the operators should not configure the operand for highly-available operation
// NOTE: External topology mode is not applicable for this field.
// +kubebuilder:default=HighlyAvailable
// +kubebuilder:validation:Enum=HighlyAvailable;SingleReplica
// +openshift:validation:FeatureGateAwareEnum:featureGate="",enum=HighlyAvailable;SingleReplica
// +openshift:validation:FeatureGateAwareEnum:featureGate=AdaptableTopology,enum=HighlyAvailable;SingleReplica;Adaptable
// +optional
InfrastructureTopology TopologyMode `json:"infrastructureTopology,omitempty"`

Expand Down Expand Up @@ -159,6 +162,10 @@ const (
// that any of the control plane components such as kubernetes API server or etcd are visible within
// the cluster.
ExternalTopologyMode TopologyMode = "External"

// "Adaptable" is for clusters that dynamically adjust control-plane and
// infrastructure behavior based on current node count.
AdaptableTopologyMode TopologyMode = "Adaptable"
)

// CPUPartitioningMode defines the mode for CPU partitioning
Expand Down
Loading