Skip to content

Commit

Permalink
Merge pull request #5777 from krzysied/patch-1
Browse files Browse the repository at this point in the history
Snapshot actuation status before refreshing cache
  • Loading branch information
k8s-ci-robot authored May 22, 2023
2 parents 1ecaed6 + 10609dc commit b22fa6a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cluster-autoscaler/core/static_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
klog.Errorf("Failed to get daemonset list: %v", err)
return caerrors.ToAutoscalerError(caerrors.ApiCallError, err)
}

// Snapshot scale-down actuation status before cache refresh.
scaleDownActuationStatus := a.scaleDownActuator.CheckStatus()
// Call CloudProvider.Refresh before any other calls to cloud provider.
refreshStart := time.Now()
err = a.AutoscalingContext.CloudProvider.Refresh()
Expand Down Expand Up @@ -596,8 +597,7 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
}
}

actuationStatus := a.scaleDownActuator.CheckStatus()
typedErr := a.scaleDownPlanner.UpdateClusterState(podDestinations, scaleDownCandidates, actuationStatus, currentTime)
typedErr := a.scaleDownPlanner.UpdateClusterState(podDestinations, scaleDownCandidates, scaleDownActuationStatus, currentTime)
// Update clusterStateRegistry and metrics regardless of whether ScaleDown was successful or not.
unneededNodes := a.scaleDownPlanner.UnneededNodes()
a.processors.ScaleDownCandidatesNotifier.Update(unneededNodes, currentTime)
Expand Down Expand Up @@ -628,7 +628,7 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr

// We want to delete unneeded Node Groups only if there was no recent scale up,
// and there is no current delete in progress and there was no recent errors.
_, drained := actuationStatus.DeletionsInProgress()
_, drained := scaleDownActuationStatus.DeletionsInProgress()
var removedNodeGroups []cloudprovider.NodeGroup
if len(drained) == 0 {
var err error
Expand Down

0 comments on commit b22fa6a

Please sign in to comment.