-
Notifications
You must be signed in to change notification settings - Fork 39.1k
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: allow kubeadm init to read config from file #34501
kubeadm: allow kubeadm init to read config from file #34501
Conversation
Jenkins verification failed for commit 227a38a. Full PR test history. The magic incantation to run this job again is |
Jenkins GCI GKE smoke e2e failed for commit 227a38a. Full PR test history. The magic incantation to run this job again is |
@@ -87,6 +97,8 @@ func NewCmdInit(out io.Writer) *cobra.Command { | |||
`Choose a specific Kubernetes version for the control plane`, | |||
) | |||
|
|||
cmd.PersistentFlags().StringVar(&cfgPath, "config", "", "Path to kubeadm config file") |
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.
Why isn't this in the API?
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 it wouldn't be of much use there really.
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.
It doesn't really make sense to put in the api. It's a path to an API object.
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.
Ok for me
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, few minor nits...
@@ -87,6 +97,8 @@ func NewCmdInit(out io.Writer) *cobra.Command { | |||
`Choose a specific Kubernetes version for the control plane`, | |||
) | |||
|
|||
cmd.PersistentFlags().StringVar(&cfgPath, "config", "", "Path to kubeadm config file") |
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 it wouldn't be of much use there really.
} | ||
i, err := NewInit(cfgPath, cfg) | ||
check(err) | ||
check(fmt.Errorf("<cmd/init> %v", i.Run(out))) |
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 don't quite understand what is this last line is for...
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 read it this way:
- First check is for errors in
NewInit
, e.g. can't read configuration file. - Second check is for the actual execution of the init process (
Init.Run(...)
).
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 have omitted the fmt.Errorf("<cmd/init> %v", ) on the last line.
if cfgPath != "" { | ||
b, err := ioutil.ReadFile(cfgPath) | ||
if err != nil { | ||
return nil, fmt.Errorf("unable to read config from %q: %v", cfgPath, err) |
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've had [%v]
in other places, which sort of implies "you can read this, but it might not be very meaningful to you". I know that : %v
is a wider convention, I'd be happy to switch if you insist, but I'm not sure it's actually a great convention... Happy to discuss in another thread.
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 will stick with [%v] then. We can revisit if we must.
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.
227a38a
to
58d25e3
Compare
@errordeveloper PTAL. |
LGTM |
@k8s-bot test this |
Bootstrap GCE e2e failed for commit 58d25e3. Full PR test history. The magic incantation to run this job again is |
@k8s-bot bootstrap gce e2e test this /lgtm |
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, let's get it in!
Thanks for the review. @errordeveloper if you comment /lgtm on prs that are assigned to you, mergebot should add lgtm label. I added it to your above comment :) let's see if it works. I'm adding do-not-merge because I want #34555 to go in before this. |
Jenkins GCE e2e failed for commit 58d25e3. Full PR test history. The magic incantation to run this job again is |
@k8s-bot ok to test, issue: #IGNORE |
@kubernetes/sig-testing hmm, my e2e's aren't getting rerun. |
@k8s-bot cvm gce e2e test this |
ahh instructions. @k8s-bot cvm gce e2e test this |
@k8s-bot bootstrap gce e2e test this |
1 similar comment
@k8s-bot bootstrap gce e2e test this |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
Automatic merge from submit-queue kubeadm join: Added support for config file. As more behavior (#34719, #34807, fix for #33641) is added to `kubeadm join`, this will be eventually very much needed. Makes sense to go in sooner rather than later. Also references #34501 and #34884. /cc @luxas @mikedanese
@kubernetes/sig-cluster-lifecycle
This change is