Skip to content

Commit 06de27f

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.
1 parent b68f109 commit 06de27f

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

pkg/controller/core/workload_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,11 @@ func (r *WorkloadReconciler) reconcileCheckBasedEviction(ctx context.Context, wl
543543
}
544544
// at this point we know a Workload has at least one Retry AdmissionCheck
545545
message := "At least one admission check is false"
546-
if err := workload.Evict(ctx, r.client, r.recorder, wl, kueue.WorkloadEvictedByAdmissionCheck, message, "", r.clock); err != nil {
546+
if err := workload.Evict(ctx, r.client, r.recorder, wl, kueue.WorkloadEvictedByAdmissionCheck, message, "", r.clock, workload.WithCustomPrepare(func() (*kueue.Workload, error) {
547+
// Set Requeued=false to track eviction, matching jobframework behavior
548+
workload.SetRequeuedCondition(wl, kueue.WorkloadEvictedByAdmissionCheck, "Evicted due to admission check retry", false)
549+
return wl, nil
550+
})); err != nil {
547551
return false, err
548552
}
549553
return true, nil

pkg/controller/core/workload_controller_test.go

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

pkg/workload/workload.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,11 @@ func PropagateResourceRequests(w *kueue.Workload, info *Info) bool {
863863
// If strict is true, resourceVersion will be part of the patch.
864864
func admissionStatusPatch(w *kueue.Workload, wlCopy *kueue.Workload) {
865865
wlCopy.Status.Admission = w.Status.Admission.DeepCopy()
866-
wlCopy.Status.RequeueState = w.Status.RequeueState.DeepCopy()
866+
// Only include RequeueState if it's set, to avoid clobbering values
867+
// set by other controllers.
868+
if w.Status.RequeueState != nil {
869+
wlCopy.Status.RequeueState = w.Status.RequeueState.DeepCopy()
870+
}
867871
if wlCopy.Status.Admission != nil {
868872
// Clear ResourceRequests; Assignment.PodSetAssignment[].ResourceUsage supercedes it
869873
wlCopy.Status.ResourceRequests = []kueue.PodSetRequest{}

0 commit comments

Comments
 (0)