Skip to content

Commit 6a3ae40

Browse files
committed
Use WorkloadRequestUseMergePatch in UpdateReclaimablePods().
1 parent 5dbd9d2 commit 6a3ae40

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

pkg/workload/workload.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,9 +1098,20 @@ func HasQuotaReservation(w *kueue.Workload) bool {
10981098

10991099
// UpdateReclaimablePods updates the ReclaimablePods list for the workload with SSA.
11001100
func UpdateReclaimablePods(ctx context.Context, c client.Client, w *kueue.Workload, reclaimablePods []kueue.ReclaimablePod) error {
1101-
patch := BaseSSAWorkload(w, false)
1102-
patch.Status.ReclaimablePods = reclaimablePods
1103-
return c.Status().Patch(ctx, patch, client.Apply, client.FieldOwner(constants.ReclaimablePodsMgr))
1101+
if features.Enabled(features.WorkloadRequestUseMergePatch) {
1102+
return clientutil.PatchStatus(ctx, c, w, func() (bool, error) {
1103+
w.Status.ReclaimablePods = reclaimablePods
1104+
return true, nil
1105+
})
1106+
}
1107+
wlPatch := BaseSSAWorkload(w, true)
1108+
wlPatch.Status.ReclaimablePods = reclaimablePods
1109+
err := c.Status().Patch(ctx, wlPatch, client.Apply, client.FieldOwner(constants.ReclaimablePodsMgr))
1110+
if err != nil {
1111+
return err
1112+
}
1113+
wlPatch.DeepCopyInto(w)
1114+
return nil
11041115
}
11051116

11061117
// ReclaimablePodsAreEqual checks if two Reclaimable pods are semantically equal

0 commit comments

Comments
 (0)