diff --git a/config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml b/config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml index 38cc06b8f0..76577fefa0 100644 --- a/config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml +++ b/config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml @@ -116,7 +116,8 @@ spec: properties: autoscaling: description: Autoscaling specifies auto scaling behaviour for - this MachinePool. + the default MachinePool. Autoscaling min/max value must be equal + or multiple of the availability zones count. properties: maxReplicas: minimum: 1 diff --git a/controlplane/rosa/api/v1beta2/rosacontrolplane_types.go b/controlplane/rosa/api/v1beta2/rosacontrolplane_types.go index b35e7f6bee..787e8060ad 100644 --- a/controlplane/rosa/api/v1beta2/rosacontrolplane_types.go +++ b/controlplane/rosa/api/v1beta2/rosacontrolplane_types.go @@ -198,7 +198,8 @@ type DefaultMachinePoolSpec struct { // +optional InstanceType string `json:"instanceType,omitempty"` - // Autoscaling specifies auto scaling behaviour for this MachinePool. + // Autoscaling specifies auto scaling behaviour for the default MachinePool. Autoscaling min/max value + // must be equal or multiple of the availability zones count. // +optional Autoscaling *expinfrav1.RosaMachinePoolAutoScaling `json:"autoscaling,omitempty"` } diff --git a/controlplane/rosa/controllers/rosacontrolplane_controller.go b/controlplane/rosa/controllers/rosacontrolplane_controller.go index e54023c202..84c9bcf1d6 100644 --- a/controlplane/rosa/controllers/rosacontrolplane_controller.go +++ b/controlplane/rosa/controllers/rosacontrolplane_controller.go @@ -611,9 +611,13 @@ func buildOCMClusterSpec(controPlaneSpec rosacontrolplanev1.RosaControlPlaneSpec } // Set cluster compute autoscaling replicas + // In case autoscaling is not defined and multiple zones defined, set the compute nodes equal to the zones count. if computeAutoscaling := controPlaneSpec.DefaultMachinePoolSpec.Autoscaling; computeAutoscaling != nil { + ocmClusterSpec.Autoscaling = true ocmClusterSpec.MaxReplicas = computeAutoscaling.MaxReplicas ocmClusterSpec.MinReplicas = computeAutoscaling.MinReplicas + } else if computeAutoscaling == nil && len(controPlaneSpec.AvailabilityZones) > 1 { + ocmClusterSpec.ComputeNodes = len(controPlaneSpec.AvailabilityZones) } if controPlaneSpec.ProvisionShardID != "" {