Skip to content

Commit 106125b

Browse files
Fix: Set Requeued condition for standalone workloads during admission check eviction
Previously, only job-managed workloads had the Requeued condition set during admission check eviction (via jobframework). Standalone workloads had no code path setting this condition. This change adds the condition to standalone workloads, ensuring consistent behavior between job-managed and standalone workloads. Signed-off-by: Sohan Kunkerkar <[email protected]>
1 parent cc40ec1 commit 106125b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pkg/controller/core/workload_controller.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,15 @@ func (r *WorkloadReconciler) reconcileCheckBasedEviction(ctx context.Context, wl
601601
}
602602
// at this point we know a Workload has at least one Retry AdmissionCheck
603603
message := "At least one admission check is false"
604-
if err := workload.Evict(ctx, r.client, r.recorder, wl, kueue.WorkloadEvictedByAdmissionCheck, message, "", r.clock); err != nil {
604+
// Calculate the retry time from admission checks before eviction resets them.
605+
maxRetryTime := workload.GetMaxRetryTime(wl)
606+
if err := workload.Evict(ctx, r.client, r.recorder, wl, kueue.WorkloadEvictedByAdmissionCheck, message, "", r.clock, workload.WithCustomPrepare(func(wl *kueue.Workload) {
607+
// Set Requeued=false to track eviction, matching jobframework behavior
608+
workload.SetRequeuedCondition(wl, kueue.WorkloadEvictedByAdmissionCheck, "Evicted due to admission check retry", false)
609+
if !maxRetryTime.IsZero() {
610+
workload.SetRequeueState(wl, maxRetryTime, false)
611+
}
612+
})); err != nil {
605613
return false, err
606614
}
607615
return true, nil

pkg/controller/core/workload_controller_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,12 @@ func TestReconcile(t *testing.T) {
981981
Reason: "AdmissionCheck",
982982
Message: "At least one admission check is false",
983983
}).
984+
Condition(metav1.Condition{
985+
Type: "Requeued",
986+
Status: "False",
987+
Reason: "AdmissionCheck",
988+
Message: "Evicted due to admission check retry",
989+
}).
984990
SchedulingStatsEviction(
985991
kueue.WorkloadSchedulingStatsEviction{
986992
Reason: kueue.WorkloadEvictedByAdmissionCheck,

0 commit comments

Comments
 (0)