Skip to content

Commit

Permalink
Rename parent-uid label to job-uid, change label validation
Browse files Browse the repository at this point in the history
  • Loading branch information
achernevskii committed Aug 3, 2023
1 parent 2478cbd commit 866a09a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
// status based on the admission status of the parent workload.
ParentWorkloadAnnotation = "kueue.x-k8s.io/parent-workload"

// ParentUIDLabel is the label key in the workload resource, that holds the UID of
// a parent.
ParentUIDLabel = "kueue.x-k8s.io/parent-uid"
// JobUIDLabel is the label key in the workload resource, that holds the UID of
// a parent job.
JobUIDLabel = "kueue.x-k8s.io/job-uid"
)
5 changes: 2 additions & 3 deletions pkg/controller/jobframework/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"context"
"errors"
"fmt"
"unicode/utf8"

corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -471,8 +470,8 @@ func (r *JobReconciler) constructWorkload(ctx context.Context, job GenericJob, o
},
}

if uid := string(job.Object().GetUID()); utf8.RuneCountInString(uid) < 64 && uid != "" {
wl.Labels[controllerconsts.ParentUIDLabel] = uid
if uid := string(job.Object().GetUID()); len(uid) < 64 && uid != "" {
wl.Labels[controllerconsts.JobUIDLabel] = uid
}

priorityClassName, p, err := r.extractPriority(ctx, podSets, job)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/jobs/job/job_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ func TestReconciler(t *testing.T) {
Queue("test-queue").
Priority(0).
SetLabels(map[string]string{
controllerconsts.ParentUIDLabel: "test-uid",
controllerconsts.JobUIDLabel: "test-uid",
}).
Obj(),
},
Expand Down

0 comments on commit 866a09a

Please sign in to comment.