Skip to content

Commit 69813fb

Browse files
authored
Removing deprecated Job Labels (#1702)
* Support for k8s v1.25 in CI * Support for k8s v1.25 in CI * Change k8s api to v1.25 * Upgrade golangci-lint version * Remove deprecated job labels * Updating dependencies * Fix Sdk
1 parent 82af677 commit 69813fb

File tree

10 files changed

+3
-41
lines changed

10 files changed

+3
-41
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.19
44

55
require (
66
github.com/go-logr/logr v1.2.3
7-
github.com/kubeflow/common v0.4.4
7+
github.com/kubeflow/common v0.4.5
88
github.com/onsi/ginkgo/v2 v2.1.6
99
github.com/onsi/gomega v1.20.1
1010
github.com/prometheus/client_golang v1.12.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
327327
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
328328
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
329329
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
330-
github.com/kubeflow/common v0.4.4 h1:QG9IgOHIsaS1bq1DtfW/yxtKkBTl5sTjRCyNicjdo10=
331-
github.com/kubeflow/common v0.4.4/go.mod h1:di43u2m7DyuwnRDb7Kwz1nmA/nhpjnQ+K+gWCV/SPZk=
330+
github.com/kubeflow/common v0.4.5 h1:W7p+s/4Za1UzIgKP2Z6ormEvsUVHykeaXaOuu8+UgpI=
331+
github.com/kubeflow/common v0.4.5/go.mod h1:di43u2m7DyuwnRDb7Kwz1nmA/nhpjnQ+K+gWCV/SPZk=
332332
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
333333
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
334334
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=

pkg/common/util/v1/testutil/pod.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ func NewBasePod(name string, job metav1.Object, refs []metav1.OwnerReference) *c
5454

5555
func NewPod(job metav1.Object, typ string, index int, refs []metav1.OwnerReference) *corev1.Pod {
5656
pod := NewBasePod(fmt.Sprintf("%s-%s-%d", job.GetName(), typ, index), job, refs)
57-
pod.Labels[commonv1.ReplicaTypeLabelDeprecated] = typ
5857
pod.Labels[commonv1.ReplicaTypeLabel] = typ
59-
pod.Labels[commonv1.ReplicaIndexLabelDeprecated] = fmt.Sprintf("%d", index)
6058
pod.Labels[commonv1.ReplicaIndexLabel] = fmt.Sprintf("%d", index)
6159
return pod
6260
}

pkg/common/util/v1/testutil/service.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ func NewBaseService(name string, job metav1.Object, refs []metav1.OwnerReference
5252

5353
func NewService(job metav1.Object, typ string, index int, refs []metav1.OwnerReference) *corev1.Service {
5454
svc := NewBaseService(fmt.Sprintf("%s-%s-%d", job.GetName(), typ, index), job, refs)
55-
svc.Labels[commonv1.ReplicaTypeLabelDeprecated] = typ
5655
svc.Labels[commonv1.ReplicaTypeLabel] = typ
57-
svc.Labels[commonv1.ReplicaIndexLabelDeprecated] = fmt.Sprintf("%d", index)
5856
svc.Labels[commonv1.ReplicaIndexLabel] = fmt.Sprintf("%d", index)
5957
return svc
6058
}

pkg/common/util/v1/testutil/util.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ import (
3030
const (
3131
LabelGroupName = "group-name"
3232
JobNameLabel = "job-name"
33-
// Deprecated label. Has to be removed later
34-
DeprecatedLabelTFJobName = "tf-job-name"
3533
)
3634

3735
var (

pkg/controller.v1/mpi/mpijob_controller.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -272,20 +272,6 @@ func (jc *MPIJobReconciler) ControllerName() string {
272272
return controllerName
273273
}
274274

275-
// GenLabels is overridden for backward compatibility
276-
// TODO(zw0610): remove this overriding method when backward compatibility is dropped
277-
func (jc *MPIJobReconciler) GenLabels(jobName string) map[string]string {
278-
// Generate basic labels from kubeflow/common
279-
basicLabels := jc.JobController.GenLabels(jobName)
280-
281-
// add "mpi-job-name" label for backward compatibility
282-
basicLabels[labelMPIJobName] = basicLabels[commonv1.JobNameLabel]
283-
// remove "job-name" as MPIJob never uses
284-
delete(basicLabels, commonv1.JobNameLabelDeprecated)
285-
286-
return basicLabels
287-
}
288-
289275
func (jc *MPIJobReconciler) GetAPIGroupVersionKind() schema.GroupVersionKind {
290276
return kubeflowv1.GroupVersion.WithKind(kubeflowv1.MPIJobKind)
291277
}

pkg/controller.v1/tensorflow/pod_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ var _ = Describe("TFJob controller", func() {
111111

112112
jobName := c.tfJob.GetName()
113113
labels := reconciler.GenLabels(jobName)
114-
labels[commonv1.ReplicaTypeLabelDeprecated] = c.rt
115114
labels[commonv1.ReplicaTypeLabel] = c.rt
116-
labels[commonv1.ReplicaIndexLabelDeprecated] = c.index
117115
labels[commonv1.ReplicaIndexLabel] = c.index
118116

119117
Expect(reconciler.SetClusterSpec(c.tfJob, podTemplate, c.rt, c.index)).Should(Succeed())

pkg/controller.v1/tensorflow/tfjob_controller.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ const (
7272

7373
controllerName = "tfjob-controller"
7474

75-
// labels for pods and servers.
76-
tfReplicaTypeLabel = "replica-type"
77-
tfReplicaIndexLabel = "replica-index"
7875
// volcanoTaskSpecKey task spec key used in pod annotation when EnableGangScheduling is true
7976
volcanoTaskSpecKey = "volcano.sh/task-spec"
8077

@@ -833,8 +830,6 @@ func (r *TFJobReconciler) createNewPod(tfjob *kubeflowv1.TFJob, rt, index string
833830

834831
// Set type and index for the worker.
835832
labels := r.GenLabels(tfjob.Name)
836-
labels[tfReplicaTypeLabel] = rt
837-
labels[tfReplicaIndexLabel] = index
838833
labels[commonv1.ReplicaTypeLabel] = rt
839834
labels[commonv1.ReplicaIndexLabel] = index
840835

pkg/controller.v1/tensorflow/util_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,11 @@ func TestGenLabels(t *testing.T) {
5252

5353
labels := reconciler.GenLabels(testJobName)
5454
jobNameLabel := commonv1.JobNameLabel
55-
JobNameLabelDeprecated := commonv1.JobNameLabelDeprecated
5655

5756
if labels[jobNameLabel] != expctedVal {
5857
t.Errorf("Expected %s %s, got %s", jobNameLabel, expctedVal, jobNameLabel)
5958
}
6059

61-
if labels[JobNameLabelDeprecated] != expctedVal {
62-
t.Errorf("Expected %s %s, got %s", JobNameLabelDeprecated, expctedVal, JobNameLabelDeprecated)
63-
}
64-
65-
if labels[commonv1.GroupNameLabelDeprecated] != kubeflowv1.GroupVersion.Group {
66-
t.Errorf("Expected %s %s, got %s", commonv1.GroupNameLabelDeprecated, kubeflowv1.GroupVersion.Group,
67-
labels[commonv1.GroupNameLabelDeprecated])
68-
}
69-
7060
if labels[commonv1.OperatorNameLabel] != controllerName {
7161
t.Errorf("Expected %s %s, got %s", commonv1.OperatorNameLabel, controllerName,
7262
labels[commonv1.OperatorNameLabel])

sdk/python/kubeflow/training/utils/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ def get_job_labels(name, master=False, replica_type=None, replica_index=None):
7676
:return: Dict: Labels
7777
"""
7878
labels = {
79-
constants.JOB_GROUP_LABEL: constants.KUBEFLOW_GROUP,
8079
constants.JOB_NAME_LABEL: name,
8180
}
8281
if master:

0 commit comments

Comments
 (0)