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

normalize docker-compose service that has name with underscore #429

Merged
merged 1 commit into from
Feb 14, 2017

Conversation

surajssd
Copy link
Member

kubernetes or openshift does not allow underscores in the object
names, while docker-compose does, in this commit the code has been
added to convert underscores to hypens.

Fixes #420

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 14, 2017
for _, testCase := range testCases {
returnValue := normalizeServiceNames(testCase.composeServiceName)
if returnValue != testCase.normalizedServiceName {
t.Log("Expected %q, got %q", testCase.normalizedServiceName, returnValue)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be Logf

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

kubernetes or openshift does not allow underscores in the object
names, while docker-compose does, in this commit the code has been
added to convert underscores to hypens.
{"foo_bar", "foo-bar"},
{"foo", "foo"},
{"foo.bar", "foo.bar"},
//{"", ""},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was purposeful!


func normalizeServiceNames(svcName string) string {
return strings.Replace(svcName, "_", "-", -1)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@kadel kadel merged commit 816b748 into kubernetes:master Feb 14, 2017
@surajssd surajssd deleted the change_service_names branch July 10, 2018 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants