Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qfix] Fix createpod name generation #160

Merged
merged 1 commit into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
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