Skip to content

Commit b725713

Browse files
authored
Merge pull request #610 from bskiba/cherry-pick-remove-unregistered-1.1
Remove old unregistered nodes before checking cluster healthiness
2 parents a4d5610 + 9b56bde commit b725713

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

cluster-autoscaler/core/static_autoscaler.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,6 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError
146146
status.GetReadableString(), a.AutoscalingContext.LogRecorder)
147147
}
148148
}()
149-
if !a.ClusterStateRegistry.IsClusterHealthy() {
150-
glog.Warning("Cluster is not ready for autoscaling")
151-
scaleDown.CleanUpUnneededNodes()
152-
return nil
153-
}
154-
155-
metrics.UpdateDurationFromStart(metrics.UpdateState, runStart)
156-
metrics.UpdateLastTime(metrics.Autoscaling, time.Now())
157-
158149
// Check if there are any nodes that failed to register in Kubernetes
159150
// master.
160151
unregisteredNodes := a.ClusterStateRegistry.GetUnregisteredNodes()
@@ -177,6 +168,14 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError
177168
return nil
178169
}
179170
}
171+
if !a.ClusterStateRegistry.IsClusterHealthy() {
172+
glog.Warning("Cluster is not ready for autoscaling")
173+
scaleDown.CleanUpUnneededNodes()
174+
return nil
175+
}
176+
177+
metrics.UpdateDurationFromStart(metrics.UpdateState, runStart)
178+
metrics.UpdateLastTime(metrics.Autoscaling, time.Now())
180179

181180
// Check if there has been a constant difference between the number of nodes in k8s and
182181
// the number of nodes on the cloud provider side.

0 commit comments

Comments
 (0)