Merge pull request #5989 from chaosi-zju/daily
fix rebalancer auto deleted failed
This commit is contained in:
commit
cf5def1e3a
|
@ -90,15 +90,12 @@ func (c *RebalancerController) Reconcile(ctx context.Context, req controllerrunt
|
||||||
return controllerruntime.Result{}, err
|
return controllerruntime.Result{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if rebalancer.Status.FinishTime == nil {
|
|
||||||
// should never reach here.
|
|
||||||
klog.Errorf("finishTime shouldn't be nil, current status: %+v", rebalancer.Status)
|
|
||||||
return controllerruntime.Result{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. when all workloads finished, judge whether the rebalancer needs cleanup.
|
// 3. when all workloads finished, judge whether the rebalancer needs cleanup.
|
||||||
rebalancer.Status = *newStatus
|
rebalancer.Status = *newStatus
|
||||||
if rebalancer.Spec.TTLSecondsAfterFinished != nil {
|
if rebalancer.Spec.TTLSecondsAfterFinished != nil {
|
||||||
|
if rebalancer.Status.FinishTime == nil {
|
||||||
|
return controllerruntime.Result{}, fmt.Errorf("finish time should not be nil")
|
||||||
|
}
|
||||||
remainingTTL := timeLeft(rebalancer)
|
remainingTTL := timeLeft(rebalancer)
|
||||||
if remainingTTL > 0 {
|
if remainingTTL > 0 {
|
||||||
return controllerruntime.Result{RequeueAfter: remainingTTL}, nil
|
return controllerruntime.Result{RequeueAfter: remainingTTL}, nil
|
||||||
|
|
|
@ -193,6 +193,12 @@ var _ = framework.SerialDescribe("workload rebalancer testing", func() {
|
||||||
framework.WaitRebalancerDisappear(karmadaClient, rebalancerName)
|
framework.WaitRebalancerDisappear(karmadaClient, rebalancerName)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ginkgo.It("create rebalancer with ttl and verify it can auto clean", func() {
|
||||||
|
rebalancer.Spec.TTLSecondsAfterFinished = ptr.To[int32](5)
|
||||||
|
framework.CreateWorkloadRebalancer(karmadaClient, rebalancer)
|
||||||
|
framework.WaitRebalancerDisappear(karmadaClient, rebalancerName)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 2. static weight scheduling
|
// 2. static weight scheduling
|
||||||
|
|
Loading…
Reference in New Issue