-
Notifications
You must be signed in to change notification settings - Fork 38.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
kubeadm: Introduce config print init/join-defaults #69617
Conversation
8687adf
to
814c792
Compare
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.
thanks @rosti
added a couple of comments.
cmd/kubeadm/app/cmd/config.go
Outdated
cmd := &cobra.Command{ | ||
Use: "print", | ||
Short: "Print configuration", | ||
Long: "This command serves as a wrapper for subcommands that are meant to print configuration or part of it.", |
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.
optionally:
meant to print configuration or part of it.
->
meant to print the default configuration or part of it.
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 command prints default configurations for subcommands provided"
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.
Updated with Tim's version, but omitted the "default" word from it as kubectl config print
may also be used to print non default configs in the future (such as current ClusterConfiguration from config map, etc.)
cmd/kubeadm/app/cmd/config.go
Outdated
|
||
For documentation visit: https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1 | ||
|
||
Note that sensitive values like the Bootstrap Token fields are replaced with silly values like %q in order to pass validation but |
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 probably replace silly
with placeholder
.
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.
+1 the language should be professional.
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
I understand what you are doing, but the readability of having a single generic function needs to be broken up a bit.
cmd/kubeadm/app/cmd/config.go
Outdated
cmd := &cobra.Command{ | ||
Use: "print", | ||
Short: "Print configuration", | ||
Long: "This command serves as a wrapper for subcommands that are meant to print configuration or part of it.", |
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 command prints default configurations for subcommands provided"
cmd/kubeadm/app/cmd/config.go
Outdated
Long: fmt.Sprintf(dedent.Dedent(` | ||
This command prints objects such as the default %s configuration that is used for 'kubeadm %s'. | ||
|
||
For documentation visit: https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1 |
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.
Yeah don't hard code this. We should provide a jump point otherwise this is a maintenance burden.
cmd/kubeadm/app/cmd/config.go
Outdated
|
||
For documentation visit: https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1 | ||
|
||
Note that sensitive values like the Bootstrap Token fields are replaced with silly values like %q in order to pass validation but |
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.
+1 the language should be professional.
cmd/kubeadm/app/cmd/config.go
Outdated
not perform the real computation for creating a token. | ||
`), action, action, sillyToken), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
allBytes := [][]byte{} |
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.
split out the run into it's own function for readability, please.
8fc9955
to
0132bc2
Compare
Updated the PR. @neolit123 @timothysc, PTAL |
LGTM, 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.
@rosti sorry for the late review
I think that this PR could be further simplified by adding the "action" parameter to getSupportedAPIObjects and getAllAPIObjectNames (that we can eventually merge since there is no historical objects to manage now)
Then we can have the deprecated print-defaults, print init-defaults and join-defaults insisting on the same code.
wdyt?
@fabriziopandini my first idea was on those lines, but that way, when |
@rosti thanks for the explanation. |
/approve |
For the docs approval: /assign @brendandburns |
/test pull-kubernetes-e2e-kops-aws |
/approve |
@tengqm do we have formatting issues here still with the generated docs? Or is the fix on our end anyway? |
In order to improve the UX of kubeadm, it was decided to introduce the following subcommands: - `kubeadm config print` - this is currently only a placeholder for subcommands that deal printing of some kind of configuration. - `kubeadm config print init-defaults` - prints the default combination of InitConfiguration and ClusterConfiguration. Selected component configs can be printed too if the `--component-configs` command line switch is used. - `kubeadm config print join-defaults` - prints the default JoinConfiguration. This command also supports the use of `--component-configs`. - `kubeadm config print-defaults` is deprecated in favor of `kubeadm config print init/join-defaults`. Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
0132bc2
to
91049ef
Compare
New changes are detected. LGTM label has been removed. |
[APPROVALNOTIFIER] This PR is APPROVED Approval requirements bypassed by manually added approval. This pull-request has been approved by: fabriziopandini, rosti, timothysc 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 |
/test pull-kubernetes-e2e-kops-aws |
What this PR does / why we need it:
In order to improve the UX of kubeadm, it was decided to introduce the
following subcommands:
kubeadm config print
- this is currently only a placeholder for subcommandsthat deal printing of some kind of configuration.
kubeadm config print init-defaults
- prints the default combination ofInitConfiguration and ClusterConfiguration. Selected component configs can be
printed too if the
--component-configs
command line switch is used.kubeadm config print join-defaults
- prints the default JoinConfiguration.This command also supports the use of
--component-configs
.kubeadm config print-defaults
is deprecated in favor ofkubeadm config print init/join-defaults
.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Refs kubernetes/kubeadm#1152
Special notes for your reviewer:
/cc @kubernetes/sig-cluster-lifecycle-pr-reviews
/area kubeadm
/kind bug
/assign @fabriziopandini
/assign @timothysc
/cc @neolit123
Release note: