Skip to content

Commit 078d3e6

Browse files
committed
fix rebalancer auto deleted failed
Signed-off-by: chaosi-zju <[email protected]>
1 parent 8fa7c2c commit 078d3e6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: pkg/controllers/workloadrebalancer/workloadrebalancer_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (c *RebalancerController) Reconcile(ctx context.Context, req controllerrunt
9090
return controllerruntime.Result{}, err
9191
}
9292

93-
if rebalancer.Status.FinishTime == nil {
93+
if newStatus.FinishTime == nil {
9494
// should never reach here.
9595
klog.Errorf("finishTime shouldn't be nil, current status: %+v", rebalancer.Status)
9696
return controllerruntime.Result{}, nil

Diff for: test/e2e/workloadrebalancer_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ var _ = framework.SerialDescribe("workload rebalancer testing", func() {
193193
framework.WaitRebalancerDisappear(karmadaClient, rebalancerName)
194194
})
195195
})
196+
197+
ginkgo.It("create rebalancer with ttl and verify it can auto clean", func() {
198+
rebalancer.Spec.TTLSecondsAfterFinished = ptr.To[int32](5)
199+
framework.CreateWorkloadRebalancer(karmadaClient, rebalancer)
200+
framework.WaitRebalancerDisappear(karmadaClient, rebalancerName)
201+
})
196202
})
197203

198204
// 2. static weight scheduling

0 commit comments

Comments
 (0)