From ee288ab6f0f6efae52c99192b362dc9748e67eef Mon Sep 17 00:00:00 2001 From: Daniel Vega-Myhre Date: Thu, 4 May 2023 18:45:59 +0000 Subject: [PATCH 1/2] update annotations --- pkg/controllers/jobset_controller.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/controllers/jobset_controller.go b/pkg/controllers/jobset_controller.go index 899666e6..21ab304f 100644 --- a/pkg/controllers/jobset_controller.go +++ b/pkg/controllers/jobset_controller.go @@ -550,6 +550,8 @@ func labelAndAnnotateObject(obj metav1.Object, js *jobset.JobSet, rjob *jobset.R labels[jobset.JobIndexKey] = strconv.Itoa(jobIdx) annotations := cloneMap(obj.GetAnnotations()) + labels[jobset.JobSetNameKey] = js.Name + labels[jobset.ReplicatedJobNameKey] = rjob.Name annotations[jobset.ReplicatedJobReplicas] = strconv.Itoa(rjob.Replicas) annotations[jobset.JobIndexKey] = strconv.Itoa(jobIdx) From 0548d9b8a817c0bf713b8488e1ca581f2c7e05b4 Mon Sep 17 00:00:00 2001 From: Daniel Vega-Myhre Date: Thu, 4 May 2023 19:00:03 +0000 Subject: [PATCH 2/2] update annotations and tests --- pkg/controllers/jobset_controller.go | 4 ++-- pkg/controllers/jobset_controller_test.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/controllers/jobset_controller.go b/pkg/controllers/jobset_controller.go index 21ab304f..f93ad450 100644 --- a/pkg/controllers/jobset_controller.go +++ b/pkg/controllers/jobset_controller.go @@ -550,8 +550,8 @@ func labelAndAnnotateObject(obj metav1.Object, js *jobset.JobSet, rjob *jobset.R labels[jobset.JobIndexKey] = strconv.Itoa(jobIdx) annotations := cloneMap(obj.GetAnnotations()) - labels[jobset.JobSetNameKey] = js.Name - labels[jobset.ReplicatedJobNameKey] = rjob.Name + annotations[jobset.JobSetNameKey] = js.Name + annotations[jobset.ReplicatedJobNameKey] = rjob.Name annotations[jobset.ReplicatedJobReplicas] = strconv.Itoa(rjob.Replicas) annotations[jobset.JobIndexKey] = strconv.Itoa(jobIdx) diff --git a/pkg/controllers/jobset_controller_test.go b/pkg/controllers/jobset_controller_test.go index 888e5d58..5ec71abc 100644 --- a/pkg/controllers/jobset_controller_test.go +++ b/pkg/controllers/jobset_controller_test.go @@ -720,6 +720,8 @@ func makeJob(args *makeJobArgs) *testutils.JobWrapper { RestartsKey: strconv.Itoa(args.restarts), }). JobAnnotations(map[string]string{ + jobset.JobSetNameKey: args.jobSetName, + jobset.ReplicatedJobNameKey: args.replicatedJobName, jobset.ReplicatedJobReplicas: strconv.Itoa(args.replicas), jobset.JobIndexKey: strconv.Itoa(args.jobIdx), }). @@ -731,6 +733,8 @@ func makeJob(args *makeJobArgs) *testutils.JobWrapper { RestartsKey: strconv.Itoa(args.restarts), }). PodAnnotations(map[string]string{ + jobset.JobSetNameKey: args.jobSetName, + jobset.ReplicatedJobNameKey: args.replicatedJobName, jobset.ReplicatedJobReplicas: strconv.Itoa(args.replicas), jobset.JobIndexKey: strconv.Itoa(args.jobIdx), })