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

kubeadm graduate bootstrap-token phase #70727

Merged
merged 1 commit into from
Nov 9, 2018

Conversation

yagonobre
Copy link
Member

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

NONE

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Nov 7, 2018
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 7, 2018
@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 7, 2018
@k8s-ci-robot
Copy link
Contributor

@yagonobre: Reiterating the mentions to trigger a notification:
@kubernetes/sig-cluster-lifecycle-pr-reviews

In response to this:

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

NONE

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/kubeadm labels Nov 7, 2018
@k8s-ci-robot k8s-ci-robot added the kind/documentation Categorizes issue or PR as related to documentation. label Nov 7, 2018
@fabriziopandini
Copy link
Member

/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 Nov 7, 2018
Copy link
Member

@fabriziopandini fabriziopandini left a 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...

@@ -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 {
Copy link
Member

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{}
Copy link
Member

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])
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

@fabriziopandini fabriziopandini Nov 8, 2018

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
Copy link
Member

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")

Copy link
Member

Choose a reason for hiding this comment

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

extra space after ,

@yagonobre
Copy link
Member Author

/test pull-kubernetes-integration

Copy link
Member

@neolit123 neolit123 left a 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
Copy link
Member

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")
Copy link
Member

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 {
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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()
Copy link
Member

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()

@neolit123
Copy link
Member

@yagonobre try running ./hack/make-rules/test-kubeadm-cmd.sh
to debug the failing integration tests.

@yagonobre
Copy link
Member Author

@neolit123 I'll take a look a bit later.

@yagonobre yagonobre changed the title [WIP] kubeadm graduate bootstrap-token phase kubeadm graduate bootstrap-token phase Nov 8, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 8, 2018
@fabriziopandini
Copy link
Member

/test pull-kubernetes-e2e-gce-100-performance

@fabriziopandini
Copy link
Member

@yagonobre well done! let's try to get this merge asap
/approve
/lgtm

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

@timothysc timothysc left a comment

Choose a reason for hiding this comment

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

/approve

@timothysc timothysc added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 9, 2018
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 34be549 into kubernetes:master Nov 9, 2018
@yagonobre yagonobre deleted the bootstrap-token branch November 9, 2018 03:31
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. area/kubeadm cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants