Skip to content

Commit

Permalink
Rename the autoscaling option
Browse files Browse the repository at this point in the history
* Renamed the "AtomicScaling" autoscaling option to
  "ZeroOrMaxNodeScaling" to be more clear about the behavior.
  • Loading branch information
hbostan committed Jun 30, 2023
1 parent 529ca8d commit d549569
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cluster-autoscaler/config/autoscaling_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ type NodeGroupAutoscalingOptions struct {
ScaleDownUnreadyTime time.Duration
// Maximum time CA waits for node to be provisioned
MaxNodeProvisionTime time.Duration
// AtomicScaling means that a node group should be scaled up or down all at once instead of one-by-one
AtomicScaling bool
// ZeroOrMaxNodeScaling means that a node group should be scaled up to maximum size or down to zero nodes all at once instead of one-by-one.
ZeroOrMaxNodeScaling bool
}

// GCEOptions contain autoscaling options specific to GCE cloud provider.
Expand Down
6 changes: 3 additions & 3 deletions cluster-autoscaler/core/scaleup/orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ func (o *ScaleUpOrchestrator) filterValidScaleUpNodeGroups(
klog.Errorf("Couldn't get autoscaling options for ng: %v", nodeGroup.Id())
}
numNodes := 1
if autoscalingOptions != nil && autoscalingOptions.AtomicScaling {
if autoscalingOptions != nil && autoscalingOptions.ZeroOrMaxNodeScaling {
numNodes = nodeGroup.MaxSize() - currentTargetSize
if o.autoscalingContext.MaxNodesTotal != 0 && currentNodeCount+numNodes > o.autoscalingContext.MaxNodesTotal {
klog.V(4).Infof("Skipping node group %s - atomic scale-up exceeds cluster node count limit", nodeGroup.Id())
Expand Down Expand Up @@ -495,7 +495,7 @@ func (o *ScaleUpOrchestrator) ComputeExpansionOption(
if err != nil {
klog.Errorf("Failed to get autoscaling options for node group %s: %v", nodeGroup.Id(), err)
}
if autoscalingOptions != nil && autoscalingOptions.AtomicScaling {
if autoscalingOptions != nil && autoscalingOptions.ZeroOrMaxNodeScaling {
if option.NodeCount > 0 && option.NodeCount != nodeGroup.MaxSize() {
option.NodeCount = nodeGroup.MaxSize()
}
Expand Down Expand Up @@ -633,7 +633,7 @@ func (o *ScaleUpOrchestrator) ComputeSimilarNodeGroups(
if err != nil {
klog.Errorf("Failed to get autoscaling options for node group %s: %v", nodeGroup.Id(), err)
}
if autoscalingOptions != nil && autoscalingOptions.AtomicScaling {
if autoscalingOptions != nil && autoscalingOptions.ZeroOrMaxNodeScaling {
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ func TestMixedScaleUp(t *testing.T) {
simpleScaleUpTest(t, config, expectedResults)
}

func TestAtomicScaleUp(t *testing.T) {
func TestZeroOrMaxNodeScaling(t *testing.T) {
options := defaultOptions
options.NodeGroupDefaults.AtomicScaling = true
options.NodeGroupDefaults.ZeroOrMaxNodeScaling = true

optionsWithLimitedMaxCores := options
optionsWithLimitedMaxCores.MaxCoresTotal = 3
Expand Down

0 comments on commit d549569

Please sign in to comment.