-
Notifications
You must be signed in to change notification settings - Fork 39.6k
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
Re-engineer the kubeadm join logic. #56014
Re-engineer the kubeadm join logic. #56014
Conversation
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.
Looks good, small comments only
@@ -69,6 +69,8 @@ func CreateBaseKubeletConfiguration(cfg *kubeadmapi.MasterConfiguration, client | |||
|
|||
// UpdateNodeWithConfigMap updates node ConfigSource with KubeletBaseConfigurationConfigMap | |||
func UpdateNodeWithConfigMap(client clientset.Interface, nodeName string) error { | |||
fmt.Println("[kubelet] Waiting for the node to update with remote base kubelet configuration...") |
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.
suggest: [kubelet] Using Dynamic Kubelet Config for node %q; config sourced from ConfigMap %q in namespace %s
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.
and in CreateBaseKubeletConfiguration
I'd like a
[kubelet] Uploading a ConfigMap %q in namespace %s with base configuration for the kubelets in the cluster
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/join.go
Outdated
if err := kubeconfigutil.WriteToDisk(kubeconfigFile, cfg); err != nil { | ||
return err | ||
} | ||
func getTLSBootstrappedClient() (clientset.Interface, error) { |
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.
add a comment here like // getTLSBootstrappedClient waits for the kubelet to perform the TLS bootstrap and then creates a k8s client of /etc/kubernetes/kubelet.conf
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/join.go
Outdated
// Loop on every falsy return. Return with an error if raised. Exit successfully if true is returned. | ||
err := wait.PollImmediateInfinite(kubeadmconstants.APICallRetryInterval, func() (bool, error) { | ||
if _, err := os.Stat(kubeletKubeConfig); err == nil { | ||
return true, nil |
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: if we really want to shorten the logic here, we could skip the if clause and write return (err == nil), nil
here instead.
What do you think is better / more readable?
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 like the return (err == nil), nil
one :) done.
[MILESTONENOTIFIER] Milestone Pull Request Current @krousey @luxas @xiangpengzhao Pull Request Labels
|
1f4489b
to
f50fd94
Compare
@luxas inline comments addressed. PTAL. Thanks! |
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.
Note that you can use fmt.Printf
here instead
@@ -39,6 +39,9 @@ import ( | |||
|
|||
// CreateBaseKubeletConfiguration creates base kubelet configuration for dynamic kubelet configuration feature. | |||
func CreateBaseKubeletConfiguration(cfg *kubeadmapi.MasterConfiguration, client clientset.Interface) error { | |||
fmt.Println(fmt.Sprintf("[kubelet] Uploading a ConfigMap %q in namespace %s with base configuration for the kubelets in the cluster", |
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.
you can write this as fmt.Printf("[kubelet] Uploading a ConfigMap %q in namespace %s with base configuration for the kubelets in the cluster", kubeadmconstants.KubeletBaseConfigurationConfigMap, metav1.NamespaceSystem)
instead
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.
Ah! I don't know what I was thinking when I wrote this... 😭
@@ -69,6 +72,9 @@ func CreateBaseKubeletConfiguration(cfg *kubeadmapi.MasterConfiguration, client | |||
|
|||
// UpdateNodeWithConfigMap updates node ConfigSource with KubeletBaseConfigurationConfigMap | |||
func UpdateNodeWithConfigMap(client clientset.Interface, nodeName string) error { | |||
fmt.Println(fmt.Sprintf("[kubelet] Using Dynamic Kubelet Config for node %q; config sourced from ConfigMap %q in namespace %s", |
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.
s/fmt.Println(fmt.Sprintf/fmt.Printf/
f50fd94
to
045937a
Compare
@luxas addressed. PTAL. Thanks! |
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.
/lgtm
/approve no-issue
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: luxas, xiangpengzhao Associated issue: 28 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 |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
/etc/kubernetes/kubelet.conf
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):ref: kubernetes/kubeadm#28 (comment)
Special notes for your reviewer:
/cc @kubernetes/sig-cluster-lifecycle-pr-reviews
Release note: