Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cluster-autoscaler/core/scaledown/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ const (
ScaleDownInCooldown
// ScaleDownInProgress - the scale down wasn't attempted, because a previous scale-down was still in progress.
ScaleDownInProgress
// ScaleDownNoCandidates - the scale down was skipped because of no scale down candidates.
ScaleDownNoCandidates
)

// NodeDeleteResultType denotes the type of the result of node deletion. It provides deeper
Expand Down
11 changes: 8 additions & 3 deletions cluster-autoscaler/core/static_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr

metrics.UpdateDurationFromStart(metrics.FindUnneeded, unneededStart)

scaleDownInCooldown := a.isScaleDownInCooldown(currentTime, scaleDownCandidates)
scaleDownInCooldown := a.isScaleDownInCooldown(currentTime)
klog.V(4).Infof("Scale down status: lastScaleUpTime=%s lastScaleDownDeleteTime=%v "+
"lastScaleDownFailTime=%s scaleDownForbidden=%v scaleDownInCooldown=%v",
a.lastScaleUpTime, a.lastScaleDownDeleteTime, a.lastScaleDownFailTime,
Expand All @@ -628,6 +628,11 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
if scaleDownInCooldown {
scaleDownStatus.Result = scaledownstatus.ScaleDownInCooldown
a.updateSoftDeletionTaints(allNodes)
} else if len(scaleDownCandidates) == 0 {
klog.V(4).Infof("Starting scale down: no scale down candidates. skipping...")
scaleDownStatus.Result = scaledownstatus.ScaleDownNoCandidates
metrics.UpdateLastTime(metrics.ScaleDown, time.Now())
a.updateSoftDeletionTaints(allNodes)
} else {
klog.V(4).Infof("Starting scale down")

Expand Down Expand Up @@ -712,8 +717,8 @@ func (a *StaticAutoscaler) addUpcomingNodesToClusterSnapshot(upcomingCounts map[
return nil
}

func (a *StaticAutoscaler) isScaleDownInCooldown(currentTime time.Time, scaleDownCandidates []*apiv1.Node) bool {
scaleDownInCooldown := a.processorCallbacks.disableScaleDownForLoop || len(scaleDownCandidates) == 0
func (a *StaticAutoscaler) isScaleDownInCooldown(currentTime time.Time) bool {
scaleDownInCooldown := a.processorCallbacks.disableScaleDownForLoop

if a.ScaleDownDelayTypeLocal {
return scaleDownInCooldown
Expand Down
Loading