@@ -627,6 +627,7 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
627627
628628 if scaleDownInCooldown {
629629 scaleDownStatus .Result = scaledownstatus .ScaleDownInCooldown
630+ a .updateSoftDeletionTaints (allNodes )
630631 } else {
631632 klog .V (4 ).Infof ("Starting scale down" )
632633
@@ -645,21 +646,7 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
645646 a .lastScaleDownDeleteTime = currentTime
646647 a .clusterStateRegistry .Recalculate ()
647648 }
648-
649- if scaleDownStatus .Result == scaledownstatus .ScaleDownNoNodeDeleted &&
650- a .AutoscalingContext .AutoscalingOptions .MaxBulkSoftTaintCount != 0 {
651- taintableNodes := a .scaleDownPlanner .UnneededNodes ()
652-
653- // Make sure we are only cleaning taints from selected node groups.
654- selectedNodes := filterNodesFromSelectedGroups (a .CloudProvider , allNodes ... )
655-
656- // This is a sanity check to make sure `taintableNodes` only includes
657- // nodes from selected nodes.
658- taintableNodes = intersectNodes (selectedNodes , taintableNodes )
659- untaintableNodes := subtractNodes (selectedNodes , taintableNodes )
660- actuation .UpdateSoftDeletionTaints (a .AutoscalingContext , taintableNodes , untaintableNodes )
661- }
662-
649+ a .updateSoftDeletionTaints (allNodes )
663650 if typedErr != nil {
664651 klog .Errorf ("Failed to scale down: %v" , typedErr )
665652 a .lastScaleDownFailTime = currentTime
@@ -679,6 +666,21 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
679666 return nil
680667}
681668
669+ func (a * StaticAutoscaler ) updateSoftDeletionTaints (allNodes []* apiv1.Node ) {
670+ if a .AutoscalingContext .AutoscalingOptions .MaxBulkSoftTaintCount != 0 {
671+ taintableNodes := a .scaleDownPlanner .UnneededNodes ()
672+
673+ // Make sure we are only cleaning taints from selected node groups.
674+ selectedNodes := filterNodesFromSelectedGroups (a .CloudProvider , allNodes ... )
675+
676+ // This is a sanity check to make sure `taintableNodes` only includes
677+ // nodes from selected nodes.
678+ taintableNodes = intersectNodes (selectedNodes , taintableNodes )
679+ untaintableNodes := subtractNodes (selectedNodes , taintableNodes )
680+ actuation .UpdateSoftDeletionTaints (a .AutoscalingContext , taintableNodes , untaintableNodes )
681+ }
682+ }
683+
682684func (a * StaticAutoscaler ) addUpcomingNodesToClusterSnapshot (upcomingCounts map [string ]int , nodeInfosForGroups map [string ]* framework.NodeInfo ) error {
683685 nodeGroups := a .nodeGroupsById ()
684686 upcomingNodeGroups := make (map [string ]int )
0 commit comments