-
Notifications
You must be signed in to change notification settings - Fork 40k
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
kubeadm graduate bootstrap-token phase #70727
Conversation
@yagonobre: Reiterating the mentions to trigger a notification: In response to this:
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. |
fbfe704
to
2b32280
Compare
/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.
@yagonobre Thanks!
Please fix tests, address nits, remove WIP.
If I'm not wrong the error is related to some inconsistent behavior in DryRun, but I'm not 100% sure...
cmd/kubeadm/app/cmd/init.go
Outdated
@@ -578,7 +532,8 @@ func runInit(i *initData, out io.Writer) error { | |||
} | |||
|
|||
// Prints the join command, multiple times in case the user has multiple tokens | |||
for _, token := range tokens { | |||
for _, bt := range i.cfg.BootstrapTokens { |
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 use initData.Tokens
Short: "Configures the node bootstrap process", | ||
Aliases: []string{"clusterinfo"}, | ||
Long: cmdutil.MacroCommandLongDescription, | ||
tokens := []string{} |
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 use initData.Tokens
}, | ||
if !skipTokenPrint { | ||
if len(tokens) == 1 { | ||
glog.V(1).Infof("[bootstraptoken] using token: %s\n", tokens[0]) |
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 use printf
[bootstraptoken] --> [bootstrap-token] (text in square breakets should match the phase name)
creating --> Creating (start all message with capital letter)
same for all the printf messages
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.
@fabriziopandini why use printf instead of glog? I guess that all phases use glog.
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.
@yagonobre we are using fmt.printf for things we want to notify to the user always (the default kubeadm output) and glog for info/debug message that can be triggered with the -v flag
However, this is a nit and if you prefer we can iterate also in following PRs.
err = node.AutoApproveNodeCertificateRotation(client) | ||
kubeadmutil.CheckErr(err) | ||
}, | ||
// Create the default node bootstrap token |
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 that this phase should give a user a message, otherwise this phase is almost silent about implemented actions. e.g.
fmt.Println("[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles")
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.
extra space after ,
/test pull-kubernetes-integration |
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.
@yagonobre thanks!
added some minor comments.
err = node.AutoApproveNodeCertificateRotation(client) | ||
kubeadmutil.CheckErr(err) | ||
}, | ||
// Create the default node bootstrap token |
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.
extra space after ,
fmt.Println(joinCommand) | ||
// Create the cluster-info ConfigMap with the associated RBAC rules | ||
if err := clusterinfophase.CreateBootstrapConfigMapIfNotExists(client, kubeconfigPath); err != nil { | ||
return errors.Wrap(err, "error creating bootstrap configmap") |
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.
ConfigMap
@@ -578,7 +532,7 @@ func runInit(i *initData, out io.Writer) error { | |||
} | |||
|
|||
// Prints the join command, multiple times in case the user has multiple tokens | |||
for _, token := range tokens { | |||
for _, token := range i.Tokens() { | |||
if err := printJoinCommand(out, adminKubeConfigPath, token, i.skipTokenPrint); err != 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.
we should move the printing of the join command outside of runInit().
this should happen right after the phase runner has executed all the phases.
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 should address this on this pr? I guess that we have another step in the tracker issue for this.
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.
sorry, indeed it was a separate step.
the scope of this PR is good.
}, | ||
cfg := data.Cfg() | ||
skipTokenPrint := data.SkipTokenPrint() | ||
kubeconfigPath := data.KubeConfigPath() |
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 see them used only once?
possibly the intermediate vars are not needed here.
just use data.Cfg() , data.KubeConfigPath() and data.KubeConfigPath()
89b675b
to
5339d78
Compare
@yagonobre try running ./hack/make-rules/test-kubeadm-cmd.sh |
@neolit123 I'll take a look a bit later. |
5339d78
to
c752c96
Compare
c752c96
to
e743f0e
Compare
/test pull-kubernetes-e2e-gce-100-performance |
@yagonobre well done! let's try to get this merge asap |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: fabriziopandini, timothysc, yagonobre 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 |
What type of PR is this?
This PR graduates phase bootstrap-token in the kubeadm init workflow.
/kind feature
What this PR does / why we need it:
Ref kubernetes/kubeadm#1163
/sig cluster-lifecycle
/priority important-soon
/assign @timothysc @fabriziopandini @neolit123
@kubernetes/sig-cluster-lifecycle-pr-reviews