Skip to content

Commit ba94506

Browse files
authored
Merge pull request #7868 from norbertcyran/clean-taints-on-copy
Clean taints on node's copy in failed scale down cleanup
2 parents 4e03407 + e97c112 commit ba94506

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

cluster-autoscaler/core/scaledown/actuation/actuator_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,10 +1274,9 @@ func runStartDeletionTest(t *testing.T, tc startDeletionTestCase, force bool) {
12741274
ndb := NewNodeDeletionBatcher(&ctx, scaleStateNotifier, ndt, 0*time.Second)
12751275
legacyFlagDrainConfig := SingleRuleDrainConfig(ctx.MaxGracefulTerminationSec)
12761276
evictor := Evictor{EvictionRetryTime: 0, PodEvictionHeadroom: DefaultPodEvictionHeadroom, shutdownGracePeriodByPodPriority: legacyFlagDrainConfig, fullDsEviction: force}
1277-
scheduler := NewGroupDeletionScheduler(&ctx, ndt, ndb, evictor)
12781277
actuator := Actuator{
12791278
ctx: &ctx, nodeDeletionTracker: ndt,
1280-
nodeDeletionScheduler: scheduler,
1279+
nodeDeletionScheduler: NewGroupDeletionScheduler(&ctx, ndt, ndb, evictor),
12811280
budgetProcessor: budgets.NewScaleDownBudgetProcessor(&ctx),
12821281
configGetter: nodegroupconfig.NewDefaultNodeGroupConfigProcessor(ctx.NodeGroupDefaults),
12831282
}
@@ -1303,15 +1302,12 @@ func runStartDeletionTest(t *testing.T, tc startDeletionTestCase, force bool) {
13031302
// Verify ScaleDownNodes looks as expected.
13041303
ignoreSdNodeOrder := cmpopts.SortSlices(func(a, b *status.ScaleDownNode) bool { return a.Node.Name < b.Node.Name })
13051304
cmpNg := cmp.Comparer(func(a, b *testprovider.TestNodeGroup) bool { return a.Id() == b.Id() })
1306-
// Deletion taint may be lifted by goroutine, ignore taints to avoid race condition
1305+
// Nodes will have deletion taints, skipping them here since we check them later
13071306
ignoreTaints := cmpopts.IgnoreFields(apiv1.NodeSpec{}, "Taints")
13081307
statusCmpOpts := cmp.Options{ignoreSdNodeOrder, cmpNg, cmpopts.EquateEmpty(), ignoreTaints}
1309-
// lock deletion scheduler so race detector does not complain
1310-
scheduler.Lock()
13111308
if diff := cmp.Diff(wantScaleDownNodes, gotScaleDownNodes, statusCmpOpts); diff != "" {
13121309
t.Errorf("StartDeletion scaled down nodes diff (-want +got):\n%s", diff)
13131310
}
1314-
scheduler.Unlock()
13151311

13161312
// Verify that all expected nodes were deleted using the cloud provider hook.
13171313
var gotDeletedNodes []string

cluster-autoscaler/core/scaledown/actuation/delete_in_batch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func CleanUpAndRecordFailedScaleDownEvent(ctx *context.AutoscalingContext, node
206206
klog.Errorf("Scale-down: "+logMsgFormat+", %v, status error: %v", node.Name, errMsg, status.Err)
207207
}
208208
ctx.Recorder.Eventf(node, apiv1.EventTypeWarning, "ScaleDownFailed", eventMsgFormat+": %v", status.Err)
209-
taints.CleanToBeDeleted(node, ctx.ClientSet, ctx.CordonNodeBeforeTerminate)
209+
taints.CleanToBeDeleted(node.DeepCopy(), ctx.ClientSet, ctx.CordonNodeBeforeTerminate)
210210
nodeDeletionTracker.EndDeletion(nodeGroupId, node.Name, status)
211211
}
212212

0 commit comments

Comments
 (0)