Skip to content

Commit 3ee30c2

Browse files
authored
Merge pull request #4914 from k8s-infra-cherrypick-robot/cherry-pick-4873-to-release-2.4
[release-2.4] 🐛 ROSA: fix auto scale and multi zone compute nodes
2 parents 08edbd7 + 90c4cd0 commit 3ee30c2

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ spec:
116116
properties:
117117
autoscaling:
118118
description: Autoscaling specifies auto scaling behaviour for
119-
this MachinePool.
119+
the default MachinePool. Autoscaling min/max value must be equal
120+
or multiple of the availability zones count.
120121
properties:
121122
maxReplicas:
122123
minimum: 1

controlplane/rosa/api/v1beta2/rosacontrolplane_types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ type DefaultMachinePoolSpec struct {
198198
// +optional
199199
InstanceType string `json:"instanceType,omitempty"`
200200

201-
// Autoscaling specifies auto scaling behaviour for this MachinePool.
201+
// Autoscaling specifies auto scaling behaviour for the default MachinePool. Autoscaling min/max value
202+
// must be equal or multiple of the availability zones count.
202203
// +optional
203204
Autoscaling *expinfrav1.RosaMachinePoolAutoScaling `json:"autoscaling,omitempty"`
204205
}

controlplane/rosa/controllers/rosacontrolplane_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,13 @@ func buildOCMClusterSpec(controPlaneSpec rosacontrolplanev1.RosaControlPlaneSpec
611611
}
612612

613613
// Set cluster compute autoscaling replicas
614+
// In case autoscaling is not defined and multiple zones defined, set the compute nodes equal to the zones count.
614615
if computeAutoscaling := controPlaneSpec.DefaultMachinePoolSpec.Autoscaling; computeAutoscaling != nil {
616+
ocmClusterSpec.Autoscaling = true
615617
ocmClusterSpec.MaxReplicas = computeAutoscaling.MaxReplicas
616618
ocmClusterSpec.MinReplicas = computeAutoscaling.MinReplicas
619+
} else if computeAutoscaling == nil && len(controPlaneSpec.AvailabilityZones) > 1 {
620+
ocmClusterSpec.ComputeNodes = len(controPlaneSpec.AvailabilityZones)
617621
}
618622

619623
if controPlaneSpec.ProvisionShardID != "" {

0 commit comments

Comments
 (0)