Skip to content

Commit

Permalink
Add computeNodes
Browse files Browse the repository at this point in the history
Signed-off-by: melserngawy <[email protected]>
  • Loading branch information
serngawy committed Mar 21, 2024
1 parent f67715e commit 4992f92
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion controlplane/rosa/api/v1beta2/rosacontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
4 changes: 4 additions & 0 deletions controlplane/rosa/controllers/rosacontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down

0 comments on commit 4992f92

Please sign in to comment.