@@ -627,6 +627,7 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
627
627
628
628
if scaleDownInCooldown {
629
629
scaleDownStatus .Result = scaledownstatus .ScaleDownInCooldown
630
+ a .updateSoftDeletionTaints (allNodes )
630
631
} else {
631
632
klog .V (4 ).Infof ("Starting scale down" )
632
633
@@ -645,21 +646,7 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
645
646
a .lastScaleDownDeleteTime = currentTime
646
647
a .clusterStateRegistry .Recalculate ()
647
648
}
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 )
663
650
if typedErr != nil {
664
651
klog .Errorf ("Failed to scale down: %v" , typedErr )
665
652
a .lastScaleDownFailTime = currentTime
@@ -679,6 +666,21 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
679
666
return nil
680
667
}
681
668
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
+
682
684
func (a * StaticAutoscaler ) addUpcomingNodesToClusterSnapshot (upcomingCounts map [string ]int , nodeInfosForGroups map [string ]* framework.NodeInfo ) error {
683
685
nodeGroups := a .nodeGroupsById ()
684
686
upcomingNodeGroups := make (map [string ]int )
0 commit comments