From 7f484fd463e3639370e5f718b30a4a59ca00e2da Mon Sep 17 00:00:00 2001 From: RainbowMango Date: Wed, 26 Apr 2023 15:17:02 +0800 Subject: [PATCH] Revert "avoid the same cluster appearing in both spec.clusters and spec.gracefulEvictionTasks" This reverts commit da44a5d9f95c2f0c8a61c0a46e8442a47b27e031. Signed-off-by: RainbowMango --- .../gracefuleviction/evictiontask.go | 7 ------- .../gracefuleviction/evictiontask_test.go | 19 ------------------- 2 files changed, 26 deletions(-) diff --git a/pkg/controllers/gracefuleviction/evictiontask.go b/pkg/controllers/gracefuleviction/evictiontask.go index 997b91d87..077cb1a2f 100644 --- a/pkg/controllers/gracefuleviction/evictiontask.go +++ b/pkg/controllers/gracefuleviction/evictiontask.go @@ -48,13 +48,6 @@ func assessEvictionTasks(bindingSpec workv1alpha2.ResourceBindingSpec, } func assessSingleTask(task workv1alpha2.GracefulEvictionTask, opt assessmentOption) *workv1alpha2.GracefulEvictionTask { - // avoid the same cluster appearing in both spec.clusters and spec.gracefulEvictionTasks - for _, targetCluster := range opt.scheduleResult { - if task.FromCluster == targetCluster.Name { - return nil - } - } - if task.SuppressDeletion != nil { if *task.SuppressDeletion { return &task diff --git a/pkg/controllers/gracefuleviction/evictiontask_test.go b/pkg/controllers/gracefuleviction/evictiontask_test.go index 5d968d074..2efb87853 100644 --- a/pkg/controllers/gracefuleviction/evictiontask_test.go +++ b/pkg/controllers/gracefuleviction/evictiontask_test.go @@ -210,25 +210,6 @@ func Test_assessSingleTask(t *testing.T) { }, want: nil, }, - { - name: "cluster appears both in targetClusters and gracefulEvictionTasks", - args: args{ - task: workv1alpha2.GracefulEvictionTask{ - FromCluster: "member1", - CreationTimestamp: metav1.Time{Time: timeNow.Add(time.Minute * -1)}, - }, - opt: assessmentOption{ - timeout: timeout, - scheduleResult: []workv1alpha2.TargetCluster{ - {Name: "member1"}, - }, - observedStatus: []workv1alpha2.AggregatedStatusItem{ - {ClusterName: "member1", Health: workv1alpha2.ResourceHealthy}, - }, - }, - }, - want: nil, - }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {