Skip to content
This repository was archived by the owner on Apr 17, 2019. It is now read-only.

Commit 679164a

Browse files
authored
Merge pull request #1188 from mwielgus/timing-fix
Cluster-autoscaler: timing in scale down fix
2 parents 0dc5a72 + f430bf0 commit 679164a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cluster-autoscaler/cluster_autoscaler.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var (
4949
"How long the node should be unneeded before it is eligible for scale down")
5050
scaleDownUtilizationThreshold = flag.Float64("scale-down-utilization-threshold", 0.5,
5151
"Node utilization level, defined as sum of requested resources divided by capacity, below which a node can be considered for scale down")
52-
scaleDownTrialInterval = flag.Duration("scale-down-trial-interval", 10*time.Minute,
52+
scaleDownTrialInterval = flag.Duration("scale-down-trial-interval", 1*time.Minute,
5353
"How often scale down possiblity is check")
5454
scanInterval = flag.Duration("scan-interval", 10*time.Second, "How often cluster is reevaluated for scale up or down")
5555
)
@@ -209,7 +209,7 @@ func main() {
209209
lastScaleDownFailedTrial.Add(*scaleDownTrialInterval).After(time.Now()) ||
210210
schedulablePodsPresent
211211

212-
glog.V(4).Info("Scale down status: unneededOnly=%v lastScaleUpTime=%s "+
212+
glog.V(4).Infof("Scale down status: unneededOnly=%v lastScaleUpTime=%s "+
213213
"lastScaleDownFailedTrail=%s schedulablePodsPresent=%v", calculateUnneededOnly,
214214
lastScaleUpTime, lastScaleDownFailedTrial, schedulablePodsPresent)
215215

@@ -246,6 +246,7 @@ func main() {
246246

247247
updateDuration("scaledown", scaleDownStart)
248248

249+
// TODO: revisit result handling
249250
if err != nil {
250251
glog.Errorf("Failed to scale down: %v", err)
251252
} else {
@@ -254,7 +255,9 @@ func main() {
254255
// deletions are made in the new context.
255256
unneededNodes = make(map[string]time.Time, len(unneededNodes))
256257
} else {
257-
lastScaleDownFailedTrial = time.Now()
258+
if result == ScaleDownError || result == ScaleDownNoNodeDeleted {
259+
lastScaleDownFailedTrial = time.Now()
260+
}
258261
}
259262
}
260263
}

0 commit comments

Comments
 (0)