-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Add node-name flag to init
phase
#48594
Add node-name flag to init
phase
#48594
Conversation
Hi @GheRivero. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is more than this needed to be done.
Default cfg.NodeName
in cmd/kubeadm/app/cmd/defaults.go
to the hostname.
Then only use cfg.NodeName
for that purpose.
Replace all os.Hostname()
and node.GetHostname("")
instances with cfg.NodeName
.
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/retest |
/lgtm |
Please update bazel etc. to fix the tests
… On 07 Jul 2017, at 21:32, k8s-ci-robot ***@***.***> wrote:
@GheRivero: The following tests failed, say /retest to rerun them all:
Test name Commit Details Rerun command
pull-kubernetes-unit 6ea7a91 link /test pull-kubernetes-unit
pull-kubernetes-federation-e2e-gce 6ea7a91 link /test pull-kubernetes-federation-e2e-gce
pull-kubernetes-verify 6ea7a91 link /test pull-kubernetes-verify
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
/retest |
@luxas - thanks a lot for providing the rationale. This sounds reasonable to me. @luxas @GheRivero - please add a release note to the PR (explaining what user problem it is fixing) and I will approve the cherrypick. |
/retest /lgtm |
@wojtek-t Release note added, should be good to go |
/test pull-kubernetes-e2e-kops-aws |
/lgtm |
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits from latest push -- thanks for adding a validation function!
The presubmits are broken anyway, so it makes sense to fix the nits while waiting.
}{ | ||
{"", nil, false}, // ok if not provided | ||
{"1234", nil, true}, // supported | ||
{hostname, nil, true}, // supported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think hard coding the value here makes sense instead of getting something from os.Hostname as that might depend on the env. What about if you run the unit test on a node with an upper-case hostname?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -177,6 +203,7 @@ func TestValidateIPNetFromString(t *testing.T) { | |||
} | |||
|
|||
func TestValidateMasterConfiguration(t *testing.T) { | |||
nodename, _ := os.Hostname() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just have something static here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
cmd/kubeadm/app/cmd/defaults.go
Outdated
@@ -71,5 +72,13 @@ func setInitDynamicDefaults(cfg *kubeadmapi.MasterConfiguration) error { | |||
} | |||
} | |||
|
|||
if cfg.NodeName == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can actually be trimmed down to cfg.NodeName = node.GetHostname(cfg.NodeName)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do this same thing in join.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
func ValidateNodeName(nodename string, fldPath *field.Path) field.ErrorList { | ||
allErrs := field.ErrorList{} | ||
if node.GetHostname(nodename) != nodename { | ||
allErrs = append(allErrs, field.Invalid(fldPath, nodename, "nodename is not valid")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: nodename is not valid, must be lower case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Allow to specify a node-name instead of relaying in `os.Hostname()` This is useful where kubelet use the name given by the cloud-provider to register the node. Partially fix: kubernetes/kubeadm#64
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very well. Thanks for rebasing @GheRivero
/lgtm
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: GheRivero, dmmcquay, luxas Associated issue: 64 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue |
Commit found in the "release-1.7" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked. |
Automatic merge from submit-queue kubeadm: Implementing the kubeconfig phase fully **What this PR does / why we need it:** This contains implementation of kubeconfig phases in kubeadm, which is part of the wider effort of implementing phases in kubeadm, previously in alpha stage. The original proposal for this activity can be found [here](https://github.com/kubernetes/kubeadm/pull/156/files) and related comments. Kubeadm phase implementation checklist is defined [here](kubernetes/kubeadm#267) Common implementation guidelines and principles for all phases are defined [here](https://docs.google.com/document/d/1VQMyFIVMfRGQPP3oCUpfjiWtOr3pLxp4g7cP-hXQFXc/edit?usp=sharing) This PR implements: - [x] kubeadm phase kubeconfig - [x] kubeadm phase kubeconfig all - [x] kubeadm phase kubeconfig admin - [x] kubeadm phase kubeconfig kubelet - [x] kubeadm phase kubeconfig scheduler - [x] kubeadm phase kubeconfig controller-manager - [x] kubeadm phase kubeconfig user **Which issue this PR fixes:** kubernetes/kubeadm#350 **Special notes for your reviewer:** This PR implements the second phases of kubeadm init; implementation of this PR follow the same approach already used for #48196 (cert phases). Please note that: - the API - phase\kubeconfig.go - is now totally free by any UX concerns, and implements only the core logic for kubeconfig generation. - the UX - cmd\phase\kubeconfig.go - now takes charge of UX commands and kubeadm own's rules for kubeconfig files in /etc/kubernetes folder (e.g. create only if not already exists) - The PR includes also a fix for a regression on a unit test for phase certs introduced by #48594 and few minor code changes in phase certs introduced to avoid code duplication between the two phases.
What this PR does / why we need it: Allow to specify a node-name instead of relaying in
os.Hostname()
This is useful where kubelet use the name given by the cloud-provider to
register the node.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): Partially fix: kubernetes/kubeadm#64Release note: