Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions pkg/controller/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ const (
// if the feature LocalQueueDefaulting is enabled and QueueLabel is not specified.
DefaultLocalQueueName kueue.LocalQueueName = "default"

// QueueAnnotation is the annotation key in the workload that holds the queue name.
//
// Deprecated: Use QueueLabel as a label key.
QueueAnnotation = QueueLabel

// PrebuiltWorkloadLabel is the label key of the job holding the name of the pre-built workload to use.
PrebuiltWorkloadLabel = "kueue.x-k8s.io/prebuilt-workload-name"

Expand Down
6 changes: 1 addition & 5 deletions pkg/controller/jobframework/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,7 @@ func QueueName(job GenericJob) kueue.LocalQueueName {
}

func QueueNameForObject(object client.Object) kueue.LocalQueueName {
if queueLabel := object.GetLabels()[constants.QueueLabel]; queueLabel != "" {
return kueue.LocalQueueName(queueLabel)
}
// fallback to the annotation (deprecated)
return kueue.LocalQueueName(object.GetAnnotations()[constants.QueueAnnotation])
return kueue.LocalQueueName(object.GetLabels()[constants.QueueLabel])
}

func MaximumExecutionTimeSeconds(job GenericJob) *int32 {
Expand Down
1 change: 0 additions & 1 deletion pkg/controller/jobframework/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ func ValidateLabelAsCRDName(obj client.Object, crdNameLabel string) field.ErrorL
func ValidateQueueName(obj client.Object) field.ErrorList {
var allErrs field.ErrorList
allErrs = append(allErrs, ValidateLabelAsCRDName(obj, constants.QueueLabel)...)
allErrs = append(allErrs, ValidateAnnotationAsCRDName(obj, constants.QueueAnnotation)...)
return allErrs
}

Expand Down
7 changes: 0 additions & 7 deletions pkg/controller/jobs/job/job_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ const (
)

var (
annotationsPath = field.NewPath("metadata", "annotations")
labelsPath = field.NewPath("metadata", "labels")
queueNameLabelPath = labelsPath.Key(constants.QueueLabel)
prebuiltWlNameLabelPath = labelsPath.Key(constants.PrebuiltWorkloadLabel)
maxExecTimeLabelPath = labelsPath.Key(constants.MaxExecTimeSecondsLabel)
queueNameAnnotationsPath = annotationsPath.Key(constants.QueueAnnotation)
workloadPriorityClassNamePath = labelsPath.Key(constants.WorkloadPriorityClassLabel)
)

Expand All @@ -81,11 +79,6 @@ func TestValidateCreate(t *testing.T) {
job: testingutil.MakeJob("job", "default").Queue("queue name").Obj(),
wantValidationErrs: field.ErrorList{field.Invalid(queueNameLabelPath, "queue name", invalidRFC1123Message)},
},
{
name: "invalid queue-name annotation (deprecated)",
job: testingutil.MakeJob("job", "default").QueueNameAnnotation("queue name").Obj(),
wantValidationErrs: field.ErrorList{field.Invalid(queueNameAnnotationsPath, "queue name", invalidRFC1123Message)},
},
{
name: "invalid partial admission annotation (format)",
job: testingutil.MakeJob("job", "default").
Expand Down
5 changes: 0 additions & 5 deletions pkg/util/testingjobs/job/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ func (j *JobWrapper) Label(key, value string) *JobWrapper {
return j
}

// QueueNameAnnotation updates the queue name of the job by annotation (deprecated)
func (j *JobWrapper) QueueNameAnnotation(queue string) *JobWrapper {
return j.SetAnnotation(constants.QueueAnnotation, queue)
}

func (j *JobWrapper) SetAnnotation(key, content string) *JobWrapper {
j.Annotations[key] = content
return j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ var _ = ginkgo.Describe("AppWrapper controller", ginkgo.Ordered, ginkgo.Continue

ginkgo.By("checking the workload is updated with queue name when the AppWrapper does")
awQueueName := "test-queue"
createdAppWrapper.Annotations = map[string]string{constants.QueueLabel: awQueueName}
createdAppWrapper.Labels = map[string]string{constants.QueueLabel: awQueueName}
gomega.Expect(k8sClient.Update(ctx, createdAppWrapper)).Should(gomega.Succeed())
gomega.Eventually(func(g gomega.Gomega) {
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ var _ = ginkgo.Describe("Job controller for workloads when only jobs with queue
}, util.Timeout, util.Interval).Should(gomega.Succeed())

ginkgo.By("checking the workload is created when queue name is set")
createdJob.Annotations = map[string]string{constants.QueueAnnotation: jobQueueName}
createdJob.Labels = map[string]string{constants.QueueLabel: jobQueueName}
gomega.Expect(k8sClient.Update(ctx, createdJob)).Should(gomega.Succeed())
gomega.Eventually(func(g gomega.Gomega) {
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ var _ = ginkgo.Describe("Job controller", ginkgo.Ordered, ginkgo.ContinueOnFailu

ginkgo.By("checking the workload is updated with queue name when the job does")
var jobQueueName kueue.LocalQueueName = "test-queue"
createdJob.Annotations = map[string]string{constants.QueueAnnotation: string(jobQueueName)}
createdJob.Labels[constants.QueueLabel] = string(jobQueueName)
gomega.Expect(k8sClient.Update(ctx, createdJob)).Should(gomega.Succeed())
gomega.Eventually(func(g gomega.Gomega) {
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeed())
Expand Down Expand Up @@ -345,7 +345,7 @@ var _ = ginkgo.Describe("Job controller", ginkgo.Ordered, ginkgo.ContinueOnFailu
ginkgo.It("Should reconcile job when queueName set by annotation (deprecated)", func() {
ginkgo.By("checking the workload is created with correct queue name assigned")
var jobQueueName kueue.LocalQueueName = "test-queue"
job := testingjob.MakeJob(jobName, ns.Name).QueueNameAnnotation("test-queue").Obj()
job := testingjob.MakeJob(jobName, ns.Name).Label(constants.QueueLabel, "test-queue").Obj()
util.MustCreate(ctx, k8sClient, job)
createdWorkload := &kueue.Workload{}
wlLookupKey := types.NamespacedName{Name: workloadjob.GetWorkloadNameForJob(job.Name, job.UID), Namespace: ns.Name}
Expand Down Expand Up @@ -1002,7 +1002,7 @@ var _ = ginkgo.Describe("When waitForPodsReady enabled", ginkgo.Ordered, ginkgo.
ginkgo.By("Create a job")
job := testingjob.MakeJob(jobName, ns.Name).Parallelism(2).Obj()
jobQueueName := "test-queue"
job.Annotations = map[string]string{constants.QueueAnnotation: jobQueueName}
job.Labels = map[string]string{constants.QueueLabel: jobQueueName}
util.MustCreate(ctx, k8sClient, job)
lookupKey := types.NamespacedName{Name: jobName, Namespace: ns.Name}
createdJob := &batchv1.Job{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ var _ = ginkgo.Describe("JobSet controller", ginkgo.Ordered, ginkgo.ContinueOnFa

ginkgo.By("checking the workload is updated with queue name when the JobSet does")
var jobSetQueueName kueue.LocalQueueName = "test-queue"
createdJobSet.Annotations = map[string]string{constants.QueueLabel: string(jobSetQueueName)}
createdJobSet.Labels = map[string]string{constants.QueueLabel: string(jobSetQueueName)}
gomega.Expect(k8sClient.Update(ctx, createdJobSet)).Should(gomega.Succeed())
gomega.Eventually(func(g gomega.Gomega) {
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeed())
Expand Down Expand Up @@ -792,7 +792,7 @@ var _ = ginkgo.Describe("JobSet controller when waitForPodsReady enabled", ginkg
},
).Obj()
jobSetQueueName := "test-queue"
jobSet.Annotations = map[string]string{constants.QueueLabel: jobSetQueueName}
jobSet.Labels = map[string]string{constants.QueueLabel: jobSetQueueName}
util.MustCreate(ctx, k8sClient, jobSet)
lookupKey := types.NamespacedName{Name: jobSetName, Namespace: ns.Name}
createdJobSet := &jobsetapi.JobSet{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func ShouldReconcileJob(ctx context.Context, k8sClient client.Client, job, creat
gomega.Expect(*createdWorkload.Spec.Priority).Should(gomega.Equal(int32(priorityValue)))

ginkgo.By("checking the workload is updated with queue name when the job does")
createdJob.Object().SetAnnotations(map[string]string{constants.QueueAnnotation: string(jobQueueName)})
createdJob.Object().SetLabels(map[string]string{constants.QueueLabel: string(jobQueueName)})
gomega.Expect(k8sClient.Update(ctx, createdJob.Object())).Should(gomega.Succeed())
util.AwaitAndVerifyWorkloadQueueName(ctx, k8sClient, createdWorkload, wlLookupKey, jobQueueName)

Expand Down Expand Up @@ -222,7 +222,7 @@ func ShouldNotReconcileUnmanagedJob(ctx context.Context, k8sClient client.Client

func JobControllerWhenWaitForPodsReadyEnabled(ctx context.Context, k8sClient client.Client, job, createdJob kubeflowjob.KubeflowJob, podsReadyTestSpec PodsReadyTestSpec, podSetsResources []PodSetsResource) {
ginkgo.By("Create a job")
job.Object().SetAnnotations(map[string]string{constants.QueueAnnotation: string(jobQueueName)})
job.Object().SetLabels(map[string]string{constants.QueueLabel: string(jobQueueName)})
util.MustCreate(ctx, k8sClient, job.Object())
lookupKey := client.ObjectKeyFromObject(job.Object())
gomega.ExpectWithOffset(1, k8sClient.Get(ctx, lookupKey, createdJob.Object())).Should(gomega.Succeed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ var _ = ginkgo.Describe("Job controller", ginkgo.Ordered, ginkgo.ContinueOnFailu

ginkgo.By("checking the workload is updated with queue name when the job does")
var jobQueueName kueue.LocalQueueName = "test-queue"
createdJob.Annotations = map[string]string{constants.QueueAnnotation: string(jobQueueName)}
createdJob.Labels = map[string]string{constants.QueueLabel: string(jobQueueName)}
gomega.Expect(k8sClient.Update(ctx, createdJob)).Should(gomega.Succeed())
gomega.Eventually(func(g gomega.Gomega) {
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeed())
Expand Down Expand Up @@ -503,7 +503,7 @@ var _ = ginkgo.Describe("Job controller for workloads when only jobs with queue

ginkgo.By("checking the workload is created when queue name is set")
jobQueueName := "test-queue"
createdJob.Annotations = map[string]string{constants.QueueAnnotation: jobQueueName}
createdJob.Labels = map[string]string{constants.QueueLabel: jobQueueName}
gomega.Expect(k8sClient.Update(ctx, createdJob)).Should(gomega.Succeed())
gomega.Eventually(func(g gomega.Gomega) {
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeed())
Expand Down Expand Up @@ -596,7 +596,7 @@ var _ = ginkgo.Describe("Job controller when waitForPodsReady enabled", ginkgo.O
GenericLauncherAndWorker().
Parallelism(2).Obj()
jobQueueName := "test-queue"
job.Annotations = map[string]string{constants.QueueAnnotation: jobQueueName}
job.Labels = map[string]string{constants.QueueLabel: jobQueueName}
util.MustCreate(ctx, k8sClient, job)
lookupKey := types.NamespacedName{Name: jobName, Namespace: ns.Name}
createdJob := &kfmpi.MPIJob{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ var _ = ginkgo.Describe("Job controller for workloads when only jobs with queue
}, util.Timeout, util.Interval).Should(gomega.Succeed())

ginkgo.By("checking the workload is created when queue name is set")
createdJob.Annotations = map[string]string{constants.QueueAnnotation: jobQueueName}
createdJob.Labels = map[string]string{constants.QueueLabel: jobQueueName}
gomega.Expect(k8sClient.Update(ctx, createdJob)).Should(gomega.Succeed())
gomega.Eventually(func(g gomega.Gomega) {
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ var _ = ginkgo.Describe("RayCluster controller", ginkgo.Ordered, ginkgo.Continue

ginkgo.By("checking the workload is updated with queue name when the job does")
var jobQueueName kueue.LocalQueueName = "test-queue"
createdJob.Annotations = map[string]string{constants.QueueAnnotation: string(jobQueueName)}
createdJob.Labels = map[string]string{constants.QueueLabel: string(jobQueueName)}
gomega.Expect(k8sClient.Update(ctx, createdJob)).Should(gomega.Succeed())
gomega.Eventually(func(g gomega.Gomega) {
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeed())
Expand Down Expand Up @@ -265,7 +265,7 @@ var _ = ginkgo.Describe("Job controller RayCluster for workloads when only jobs
ginkgo.By("checking the workload is created when queue name is set")
jobQueueName := "test-queue"
if createdJob.Labels == nil {
createdJob.Labels = map[string]string{constants.QueueAnnotation: jobQueueName}
createdJob.Labels = map[string]string{constants.QueueLabel: jobQueueName}
} else {
createdJob.Labels[constants.QueueLabel] = jobQueueName
}
Expand Down Expand Up @@ -337,7 +337,7 @@ var _ = ginkgo.Describe("Job controller when waitForPodsReady enabled", ginkgo.O
ginkgo.By("Create a job")
job := testingraycluster.MakeCluster(jobName, ns.Name).Obj()
jobQueueName := "test-queue"
job.Annotations = map[string]string{constants.QueueAnnotation: jobQueueName}
job.Labels = map[string]string{constants.QueueLabel: jobQueueName}
util.MustCreate(ctx, k8sClient, job)
lookupKey := types.NamespacedName{Name: jobName, Namespace: ns.Name}
createdJob := &rayv1.RayCluster{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ var _ = ginkgo.Describe("Job controller", ginkgo.Ordered, ginkgo.ContinueOnFailu

ginkgo.By("checking the workload is updated with queue name when the job does")
var jobQueueName kueue.LocalQueueName = "test-queue"
createdJob.Annotations = map[string]string{constants.QueueAnnotation: string(jobQueueName)}
createdJob.Labels = map[string]string{constants.QueueLabel: string(jobQueueName)}
gomega.Expect(k8sClient.Update(ctx, createdJob)).Should(gomega.Succeed())
gomega.Eventually(func(g gomega.Gomega) {
g.Expect(k8sClient.Get(ctx, wlLookupKey, createdWorkload)).Should(gomega.Succeed())
Expand Down Expand Up @@ -303,7 +303,7 @@ var _ = ginkgo.Describe("Job controller for workloads when only jobs with queue
ginkgo.By("checking the workload is created when queue name is set")
jobQueueName := "test-queue"
if createdJob.Labels == nil {
createdJob.Labels = map[string]string{constants.QueueAnnotation: jobQueueName}
createdJob.Labels = map[string]string{constants.QueueLabel: jobQueueName}
} else {
createdJob.Labels[constants.QueueLabel] = jobQueueName
}
Expand Down Expand Up @@ -352,7 +352,7 @@ var _ = ginkgo.Describe("Job controller when waitForPodsReady enabled", ginkgo.O
ginkgo.By("Create a job")
job := testingrayjob.MakeJob(jobName, ns.Name).WithSubmissionMode(rayv1.K8sJobMode).Obj()
jobQueueName := "test-queue"
job.Annotations = map[string]string{constants.QueueAnnotation: jobQueueName}
job.Labels = map[string]string{constants.QueueLabel: jobQueueName}
util.MustCreate(ctx, k8sClient, job)
lookupKey := types.NamespacedName{Name: jobName, Namespace: ns.Name}
setInitStatus(jobName, ns.Name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ var _ = ginkgo.Describe("Job Webhook With manageJobsWithoutQueueName enabled", g
createdJob := &batchv1.Job{}
gomega.Expect(k8sClient.Get(ctx, lookupKey, createdJob)).Should(gomega.Succeed())

createdJob.Annotations = map[string]string{constants.QueueAnnotation: "queue"}
createdJob.Labels = map[string]string{constants.QueueLabel: "queue"}
createdJob.Spec.Suspend = ptr.To(false)
gomega.Expect(k8sClient.Update(ctx, createdJob)).ShouldNot(gomega.Succeed())
})
Expand Down