diff --git a/cluster-autoscaler/core/static_autoscaler.go b/cluster-autoscaler/core/static_autoscaler.go index e86c6a2fc870..e3828149931a 100644 --- a/cluster-autoscaler/core/static_autoscaler.go +++ b/cluster-autoscaler/core/static_autoscaler.go @@ -318,6 +318,8 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr 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() @@ -601,8 +603,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)