Skip to content

Commit

Permalink
Merge pull request #160 from d-uzlov/qfix-create-pod-name-generation
Browse files Browse the repository at this point in the history
[qfix] Fix createpod name generation
  • Loading branch information
denis-tingaikin authored May 24, 2021
2 parents c9fe0b0 + 361d267 commit d7a1a2c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/networkservice/common/createpod/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func WithLabelsKey(labelsKey string) Option {
}

// WithNameGenerator sets function to be used for pod name generation.
// Default behavior is to append "-nodeName=<nodeName>" to the template name.
// Default behavior is to append "--on-node--<nodeName>" to the template name.
func WithNameGenerator(nameGenerator func(templateName, nodeName string) string) Option {
return func(t *createPodServer) {
t.nameGenerator = nameGenerator
Expand Down
2 changes: 1 addition & 1 deletion pkg/networkservice/common/createpod/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewServer(client kubernetes.Interface, podTemplate *corev1.Pod, options ...
namespace: "default",
labelsKey: "NSM_LABELS",
nameGenerator: func(templateName, nodeName string) string {
return templateName + "-nodeName=" + nodeName
return templateName + "--on-node--" + nodeName
},
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/networkservice/common/createpod/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestCreatePod_RepeatedRequest(t *testing.T) {
Connection: &networkservice.Connection{},
})
require.Error(t, err)
require.Equal(t, "pods \""+podTemplate.ObjectMeta.Name+"-nodeName="+nodeName1+"\" already exists", err.Error())
require.Equal(t, "pods \""+podTemplate.ObjectMeta.Name+"--on-node--"+nodeName1+"\" already exists", err.Error())

podList, err := clientSet.CoreV1().Pods(testNamespace).List(ctx, metav1.ListOptions{})
require.NoError(t, err)
Expand Down

0 comments on commit d7a1a2c

Please sign in to comment.