Commit b664aebb authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #48915 from mattmoyer/fix-kubeadm-config-regression

Automatic merge from submit-queue kubeadm: fix broken `kubeadm init --config` flag **What this PR does / why we need it**: This code was changed in ea196490 (https://github.com/kubernetes/kubernetes/pull/43558) to validate that `--config` wasn't passed along with other flags. Unfortunately, the implementation was checking `PersistentFlags()`, which was not parsed at the point it was being validated. The fix is to use `Flags()` instead, which contains the expected data. **Which issue this PR fixes** fixes https://github.com/kubernetes/kubeadm/issues/345 **Special notes for your reviewer**: This is a regression that was cherry picked (https://github.com/kubernetes/kubernetes/pull/48577) into the `release-1.7` branch. We should fix this before the next 1.7 point release. This is awkward to unit test without restructuring the code. I think this command parsing code would be a good candidate for some higher level tests. **Release note**: ```release-note Fix a regression that broke the `--config` flag for `kubeadm init`. ``` /assign @luxas
parents b4620c3e ae35377e
...@@ -206,7 +206,7 @@ type Init struct { ...@@ -206,7 +206,7 @@ type Init struct {
// Validate validates configuration passed to "kubeadm init" // Validate validates configuration passed to "kubeadm init"
func (i *Init) Validate(cmd *cobra.Command) error { func (i *Init) Validate(cmd *cobra.Command) error {
if err := validation.ValidateMixedArguments(cmd.PersistentFlags()); err != nil { if err := validation.ValidateMixedArguments(cmd.Flags()); err != nil {
return err return err
} }
return validation.ValidateMasterConfiguration(i.cfg).ToAggregate() return validation.ValidateMasterConfiguration(i.cfg).ToAggregate()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment