Skip to content

Commit

Permalink
Remove old unregistered nodes before checking cluster healthiness
Browse files Browse the repository at this point in the history
  • Loading branch information
bskiba committed Feb 2, 2018
1 parent a4d5610 commit 9b56bde
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions cluster-autoscaler/core/static_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,6 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError
status.GetReadableString(), a.AutoscalingContext.LogRecorder)
}
}()
if !a.ClusterStateRegistry.IsClusterHealthy() {
glog.Warning("Cluster is not ready for autoscaling")
scaleDown.CleanUpUnneededNodes()
return nil
}

metrics.UpdateDurationFromStart(metrics.UpdateState, runStart)
metrics.UpdateLastTime(metrics.Autoscaling, time.Now())

// Check if there are any nodes that failed to register in Kubernetes
// master.
unregisteredNodes := a.ClusterStateRegistry.GetUnregisteredNodes()
Expand All @@ -177,6 +168,14 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError
return nil
}
}
if !a.ClusterStateRegistry.IsClusterHealthy() {
glog.Warning("Cluster is not ready for autoscaling")
scaleDown.CleanUpUnneededNodes()
return nil
}

metrics.UpdateDurationFromStart(metrics.UpdateState, runStart)
metrics.UpdateLastTime(metrics.Autoscaling, time.Now())

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

0 comments on commit 9b56bde

Please sign in to comment.