Skip to content

Commit 55a18a3

Browse files
authored
Merge pull request #6756 from towca/jtuznik/cp-1.30
[CA 1.30 #6677 cherry-pick] fix: scale up broken for providers not implementing NodeGroup.GetOptions()
2 parents 9d69082 + 3a26603 commit 55a18a3

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

cluster-autoscaler/cloudprovider/cloud_provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ type NodeGroup interface {
243243

244244
// GetOptions returns NodeGroupAutoscalingOptions that should be used for this particular
245245
// NodeGroup. Returning a nil will result in using default options.
246-
// Implementation optional.
246+
// Implementation optional. Callers MUST handle `cloudprovider.ErrNotImplemented`.
247247
GetOptions(defaults config.NodeGroupAutoscalingOptions) (*config.NodeGroupAutoscalingOptions, error)
248248
}
249249

cluster-autoscaler/core/scaleup/orchestrator/orchestrator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ func (o *ScaleUpOrchestrator) filterValidScaleUpNodeGroups(
408408
continue
409409
}
410410
autoscalingOptions, err := nodeGroup.GetOptions(o.autoscalingContext.NodeGroupDefaults)
411-
if err != nil {
411+
if err != nil && err != cloudprovider.ErrNotImplemented {
412412
klog.Errorf("Couldn't get autoscaling options for ng: %v", nodeGroup.Id())
413413
}
414414
numNodes := 1
@@ -465,7 +465,7 @@ func (o *ScaleUpOrchestrator) ComputeExpansionOption(
465465
metrics.UpdateDurationFromStart(metrics.Estimate, estimateStart)
466466

467467
autoscalingOptions, err := nodeGroup.GetOptions(o.autoscalingContext.NodeGroupDefaults)
468-
if err != nil {
468+
if err != nil && err != cloudprovider.ErrNotImplemented {
469469
klog.Errorf("Failed to get autoscaling options for node group %s: %v", nodeGroup.Id(), err)
470470
}
471471
if autoscalingOptions != nil && autoscalingOptions.ZeroOrMaxNodeScaling {
@@ -662,7 +662,7 @@ func (o *ScaleUpOrchestrator) ComputeSimilarNodeGroups(
662662
}
663663

664664
autoscalingOptions, err := nodeGroup.GetOptions(o.autoscalingContext.NodeGroupDefaults)
665-
if err != nil {
665+
if err != nil && err != cloudprovider.ErrNotImplemented {
666666
klog.Errorf("Failed to get autoscaling options for node group %s: %v", nodeGroup.Id(), err)
667667
}
668668
if autoscalingOptions != nil && autoscalingOptions.ZeroOrMaxNodeScaling {

cluster-autoscaler/core/static_autoscaler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ func (a *StaticAutoscaler) removeOldUnregisteredNodes(allUnregisteredNodes []clu
794794
nodesToDelete := toNodes(unregisteredNodesToDelete)
795795

796796
opts, err := nodeGroup.GetOptions(a.NodeGroupDefaults)
797-
if err != nil {
797+
if err != nil && err != cloudprovider.ErrNotImplemented {
798798
klog.Warningf("Failed to get node group options for %s: %s", nodeGroupId, err)
799799
continue
800800
}
@@ -874,7 +874,7 @@ func (a *StaticAutoscaler) deleteCreatedNodesWithErrors() (bool, error) {
874874
} else {
875875
var opts *config.NodeGroupAutoscalingOptions
876876
opts, err = nodeGroup.GetOptions(a.NodeGroupDefaults)
877-
if err != nil {
877+
if err != nil && err != cloudprovider.ErrNotImplemented {
878878
klog.Warningf("Failed to get node group options for %s: %s", nodeGroupId, err)
879879
continue
880880
}

0 commit comments

Comments
 (0)