Skip to content

Commit eb3c0bf

Browse files
Add patchStrategy=merge
1 parent fd3b6d3 commit eb3c0bf

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

apis/kueue/v1beta1/clusterqueue_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ type ClusterQueueStatus struct {
205205
// +optional
206206
// +listType=map
207207
// +listMapKey=type
208-
Conditions []metav1.Condition `json:"conditions,omitempty"`
208+
// +patchStrategy=merge
209+
// +patchMergeKey=type
210+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
209211
}
210212

211213
type FlavorUsage struct {

apis/kueue/v1beta1/localqueue_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ type LocalQueueStatus struct {
4747
// +optional
4848
// +listType=map
4949
// +listMapKey=type
50-
Conditions []metav1.Condition `json:"conditions:omitempty"`
50+
// +patchStrategy=merge
51+
// +patchMergeKey=type
52+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
5153

5254
// flavorUsage are the used quotas, by flavor currently in use by the
5355
// workloads assigned to this LocalQueue.

apis/kueue/v1beta1/workload_types.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ type WorkloadStatus struct {
146146
// +optional
147147
// +listType=map
148148
// +listMapKey=type
149-
Conditions []metav1.Condition `json:"conditions,omitempty"`
149+
// +patchStrategy=merge
150+
// +patchMergeKey=type
151+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
150152

151153
// reclaimablePods keeps track of the number pods within a podset for which
152154
// the resource reservation is no longer needed.
@@ -159,7 +161,9 @@ type WorkloadStatus struct {
159161
// +optional
160162
// +listType=map
161163
// +listMapKey=type
162-
AdmissionChecks []metav1.Condition `json:"admissionChecks,omitempty"`
164+
// +patchStrategy=merge
165+
// +patchMergeKey=type
166+
AdmissionChecks []metav1.Condition `json:"admissionChecks,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
163167
}
164168

165169
type ReclaimablePod struct {

pkg/controller/jobs/job/job_controller_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ var (
332332
cmpopts.SortSlices(func(a, b kueue.Workload) bool {
333333
return a.Name < b.Name
334334
}),
335+
cmpopts.SortSlices(func(a, b metav1.Condition) bool {
336+
return a.Type < b.Type
337+
}),
335338
cmpopts.IgnoreFields(
336339
kueue.Workload{}, "TypeMeta", "ObjectMeta.OwnerReferences",
337340
"ObjectMeta.Name", "ObjectMeta.ResourceVersion",
@@ -350,7 +353,6 @@ func TestReconciler(t *testing.T) {
350353
Image("", nil)
351354

352355
cases := map[string]struct {
353-
focus bool
354356
reconcilerOptions []jobframework.Option
355357
job batchv1.Job
356358
wantJob batchv1.Job
@@ -761,7 +763,6 @@ func TestReconciler(t *testing.T) {
761763
},
762764
},
763765
"when job completes, workload is marked as finished": {
764-
focus: true,
765766
job: *baseJobWrapper.Clone().
766767
Queue("foo").
767768
Condition(batchv1.JobCondition{Type: batchv1.JobComplete, Status: corev1.ConditionTrue}).
@@ -819,9 +820,6 @@ func TestReconciler(t *testing.T) {
819820
}
820821
for name, tc := range cases {
821822
t.Run(name, func(t *testing.T) {
822-
if !tc.focus {
823-
t.Skip()
824-
}
825823
ctx, _ := utiltesting.ContextWithLog(t)
826824
clientBuilder := utiltesting.NewClientBuilder()
827825
if err := SetupIndexes(ctx, utiltesting.AsIndexer(clientBuilder)); err != nil {

0 commit comments

Comments
 (0)