Skip to content

Commit

Permalink
Сlear RequeuAt on workload backoff finished.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbobrovskyi committed May 6, 2024
1 parent f108fef commit 30fa599
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/controller/core/workload_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ func (r *WorkloadReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
if requeueAfter > 0 {
return reconcile.Result{RequeueAfter: requeueAfter}, nil
}
if wl.Status.RequeueState != nil {
wl.Status.RequeueState.RequeueAt = nil
}
workload.SetRequeuedCondition(&wl, kueue.WorkloadBackoffFinished, "The workload backoff was finished", true)
updated = true
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/core/workload_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ func TestReconcile(t *testing.T) {
Reason: kueue.WorkloadBackoffFinished,
Message: "The workload backoff was finished",
}).
RequeueState(ptr.To[int32](1), ptr.To(metav1.NewTime(testStartTime.Truncate(time.Second)))).
RequeueState(ptr.To[int32](1), nil).
Obj(),
},
"shouldn't set the WorkloadRequeued condition when backoff expires and workload finished": {
Expand Down
4 changes: 4 additions & 0 deletions test/integration/controller/jobs/job/job_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,10 @@ var _ = ginkgo.Describe("Job controller interacting with scheduler when waitForP
g.Expect(createdJob.Status.Ready).ShouldNot(gomega.BeNil())
g.Expect(*createdJob.Status.Ready).Should(gomega.Equal(int32(1)))
g.Expect(k8sClient.Get(ctx, wlKey, wl)).Should(gomega.Succeed())
g.Expect(wl.Status.RequeueState).ShouldNot(gomega.BeNil())
g.Expect(wl.Status.RequeueState.Count).ShouldNot(gomega.BeNil())
g.Expect(*wl.Status.RequeueState.Count, 0).Should(gomega.Equal(int32(1)))
g.Expect(wl.Status.RequeueState.RequeueAt).Should(gomega.BeNil())
g.Expect(wl.Status.Conditions).To(gomega.ContainElements(
gomega.BeComparableTo(metav1.Condition{
Type: kueue.WorkloadPodsReady,
Expand Down

0 comments on commit 30fa599

Please sign in to comment.