Skip to content

Commit

Permalink
Use tf_job_name not tf_job_key as the label name.
Browse files Browse the repository at this point in the history
* tf_job_name is consistent with v1alpha1; this desirable from a compatibility
  perspective.

* tf_job_key isn't quite right because the job key includes namespace
  but we are no longer using the namespace in the value

Related to kubeflow#672
  • Loading branch information
jlewi committed Jun 21, 2018
1 parent 3d9afd1 commit 85308ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

const (
LabelGroupName = "group_name"
labelTFJobKey = "tf_job_key"
labelTFJobName = "tf_job_name"
)

var (
Expand All @@ -48,10 +48,10 @@ func GenOwnerReference(tfjob *tfv1alpha2.TFJob) *metav1.OwnerReference {
return controllerRef
}

func GenLabels(tfjobKey string) map[string]string {
func GenLabels(tfJobName string) map[string]string {
return map[string]string{
LabelGroupName: tfv1alpha2.GroupName,
labelTFJobKey: strings.Replace(tfjobKey, "/", "-", -1),
labelTFJobName: strings.Replace(tfJobName, "/", "-", -1),
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/generator/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func TestGenLabels(t *testing.T) {

labels := GenLabels(testKey)

if labels[labelTFJobKey] != expctedKey {
t.Errorf("Expected %s %s, got %s", labelTFJobKey, expctedKey, labels[labelTFJobKey])
if labels[labelTFJobName] != expctedKey {
t.Errorf("Expected %s %s, got %s", labelTFJobName, expctedKey, labels[labelTFJobName])
}
if labels[LabelGroupName] != tfv1alpha2.GroupName {
t.Errorf("Expected %s %s, got %s", LabelGroupName, tfv1alpha2.GroupName, labels[LabelGroupName])
Expand Down

0 comments on commit 85308ed

Please sign in to comment.