Skip to content

Commit

Permalink
Merge pull request #1782 from losipiuk/lo/fix-refresh
Browse files Browse the repository at this point in the history
Call CloudProvider.Refresh before getNodeInfosForGroups
  • Loading branch information
k8s-ci-robot authored Mar 12, 2019
2 parents 9652ffb + 2474dc2 commit 951239d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cluster-autoscaler/core/static_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError
return errors.ToAutoscalerError(errors.ApiCallError, err)
}

// Call CloudProvider.Refresh before any other calls to cloud provider.
err = a.AutoscalingContext.CloudProvider.Refresh()
if err != nil {
klog.Errorf("Failed to refresh cloud provider config: %v", err)
return errors.ToAutoscalerError(errors.CloudProviderError, err)
}

nodeInfosForGroups, autoscalerError := getNodeInfosForGroups(
readyNodes, a.nodeInfoCache, autoscalingContext.CloudProvider, autoscalingContext.ListerRegistry, daemonsets, autoscalingContext.PredicateChecker)
if autoscalerError != nil {
Expand Down Expand Up @@ -539,13 +546,7 @@ func (a *StaticAutoscaler) actOnEmptyCluster(allNodes, readyNodes []*apiv1.Node,
}

func (a *StaticAutoscaler) updateClusterState(allNodes []*apiv1.Node, nodeInfosForGroups map[string]*schedulernodeinfo.NodeInfo, currentTime time.Time) errors.AutoscalerError {
err := a.AutoscalingContext.CloudProvider.Refresh()
if err != nil {
klog.Errorf("Failed to refresh cloud provider config: %v", err)
return errors.ToAutoscalerError(errors.CloudProviderError, err)
}

err = a.clusterStateRegistry.UpdateNodes(allNodes, nodeInfosForGroups, currentTime)
err := a.clusterStateRegistry.UpdateNodes(allNodes, nodeInfosForGroups, currentTime)
if err != nil {
klog.Errorf("Failed to update node registry: %v", err)
a.scaleDown.CleanUpUnneededNodes()
Expand Down

0 comments on commit 951239d

Please sign in to comment.