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

lowercase node name in generated static pod name #59849

Merged

Conversation

yue9944882
Copy link
Member

@yue9944882 yue9944882 commented Feb 14, 2018

What this PR does / why we need it:
Cast appended node name to lowercase when generating static pod name on kubelet starting.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #59801

Special notes for your reviewer:
Not sure about how to deal with other illegal node names e.g. containing invalid no-alphabetic characters. Maybe just let it fail-hard is not a bad idea.
But considering that containing uppercase letter in the hostname is somehow a usual case even in the production environment of some companies, tolerating uppercase and cast it implicitly should be good.

Release note:

force node name lowercase on static pod name generating

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 14, 2018
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 14, 2018
@yue9944882
Copy link
Member Author

/assign @dchen1107

@yue9944882 yue9944882 changed the title force node name in generated static pod name lowercase lowercase node name in generated static pod name Feb 14, 2018
@gyliu513
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 14, 2018
Copy link
Contributor

@gyliu513 gyliu513 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2018
Copy link
Contributor

@gyliu513 gyliu513 left a comment

Choose a reason for hiding this comment

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

Just found that we do not have unit-test for this function, can you please add a unit test for this?

@errordeveloper
Copy link
Member

/retest
/lgtm

@yue9944882 yue9944882 force-pushed the forcibly-lower-staticpod-name branch from b417d3e to a331f81 Compare February 14, 2018 23:47
@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2018
@yue9944882
Copy link
Member Author

yue9944882 commented Feb 14, 2018

@errordeveloper I just made some stupid mistake in my previous submit. Plz take another look thx.

@yue9944882
Copy link
Member Author

@gyliu513 WDYM?A unittest proving the node name is successfully lowercased?

@gyliu513
Copy link
Contributor

@yue9944882 yes, add a new unit test case for the function that you updated

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 17, 2018
@yue9944882
Copy link
Member Author

@gyliu513 PTAL thx😉

@yue9944882 yue9944882 force-pushed the forcibly-lower-staticpod-name branch 2 times, most recently from 4bec3fe to d96b2e8 Compare February 17, 2018 09:46
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 17, 2018
Copy link
Contributor

@gyliu513 gyliu513 left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks @yue9944882

@yue9944882
Copy link
Member Author

@yujuhong @tallclair @Random-Liu Do u think about approving this plz? thx

@tallclair
Copy link
Member

This seems like it might be a deeper issue. If uppercase node names are allowed, what happens when you have 2 nodes with the same name but different capitalization?

@yue9944882
Copy link
Member Author

yue9944882 commented Feb 20, 2018

This seems like it might be a deeper issue. If uppercase node names are allowed, what happens when you have 2 nodes with the same name but different capitalization?

@tallclair I think either one of static pods will fail to be created due to pod name conflict. How do you think about adding random suffix to the static pod name?

nodeName := types.NodeName(hostname)

Actually uppercase node name is allowed currently. Solving this issue might be simple as "allow" or "not allow". For former case, we should provide full support for uppercase node name, or rather, making sure every static pod created successfully. OTOH, we should make kubelet with uppercase node name fail-hard before it joining the cluster. WYDT?

@gyliu513
Copy link
Contributor

I prefer that we keep current logic of lower case the host name directly as it is not good to have two same host name in one cluster but different capitalization, please take a look at calico, it is already coverting all host name to lowercase automatically projectcalico/calico#1441 (comment) , comments @yue9944882 @tallclair

@dchen1107
Copy link
Member

I am ok with current logic, but want to make sure the cause described at #59849 (comment) has a explicit error for one of failing static pod. @yue9944882 can you add another tests with two nodes with same name but different capitalization?

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 24, 2018
@dchen1107 dchen1107 removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 24, 2018
@dchen1107
Copy link
Member

I approved this pr, but cancelled lgtm. Once you addressed my comment, please feel free to re-apply lgtm. Thanks!

@yue9944882 yue9944882 force-pushed the forcibly-lower-staticpod-name branch from d96b2e8 to fdd3601 Compare February 25, 2018 16:01
@yue9944882
Copy link
Member Author

@dchen1107 ACK, test added.

@yue9944882
Copy link
Member Author

/test pull-kubernetes-unit

Copy link
Contributor

@gyliu513 gyliu513 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 26, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dchen1107, errordeveloper, gyliu513, yue9944882

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 52b7aab into kubernetes:master Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloud Provider should not return upper case hostname
7 participants