Skip to content

Commit 7db8b83

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 7db8b83

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pkg/controller/core/workload_controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,10 @@ 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+
if err := workload.Evict(ctx, r.client, r.recorder, wl, kueue.WorkloadEvictedByAdmissionCheck, message, "", r.clock, workload.WithCustomPrepare(func(wl *kueue.Workload) {
605+
// Set Requeued=false to track eviction, matching jobframework behavior
606+
workload.SetRequeuedCondition(wl, kueue.WorkloadEvictedByAdmissionCheck, "Evicted due to admission check retry", false)
607+
})); err != nil {
605608
return false, err
606609
}
607610
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)