Skip to content

Commit 33466a6

Browse files
committed
kubeadm: Add '--yes' flag to the list of allowed flags
Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
1 parent efef326 commit 33466a6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cmd/kubeadm/app/apis/kubeadm/validation/validation.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ func isAllowedFlag(flagName string) bool {
609609
kubeadmcmdoptions.NodeName,
610610
kubeadmcmdoptions.KubeconfigDir,
611611
kubeadmcmdoptions.UploadCerts,
612-
"print-join-command", "rootfs", "v", "log-file")
612+
"print-join-command", "rootfs", "v", "log-file", "yes")
613613
if allowedFlags.Has(flagName) {
614614
return true
615615
}

cmd/kubeadm/app/apis/kubeadm/validation/validation_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -749,9 +749,11 @@ func TestValidateMixedArguments(t *testing.T) {
749749
// Expected to succeed, --config is mixed with skip-* flags only or no other flags
750750
{[]string{"--config=hello", "--skip-token-print=true"}, true},
751751
{[]string{"--config=hello", "--ignore-preflight-errors=baz", "--skip-token-print"}, true},
752+
{[]string{"--config=hello", "--yes=true"}, true},
752753
// Expected to fail, --config is mixed with the --foo flag
753754
{[]string{"--config=hello", "--ignore-preflight-errors=baz", "--foo=bar"}, false},
754755
{[]string{"--config=hello", "--foo=bar"}, false},
756+
{[]string{"--config=hello", "--yes=true", "--foo=bar"}, false},
755757
// Expected to fail, --config is mixed with the upgrade related flag
756758
{[]string{"--config=hello", "--allow-experimental-upgrades"}, false},
757759
}
@@ -767,6 +769,7 @@ func TestValidateMixedArguments(t *testing.T) {
767769
f.StringSliceVar(&ignorePreflightErrors, "ignore-preflight-errors", ignorePreflightErrors, "flag not bound to config object")
768770
f.Bool("allow-experimental-upgrades", true, "upgrade flags for plan and apply command")
769771
f.Bool("skip-token-print", false, "flag not bound to config object")
772+
f.Bool("yes", false, "flag not bound to config object")
770773
f.StringVar(&cfgPath, "config", cfgPath, "Path to kubeadm config file")
771774
if err := f.Parse(rt.args); err != nil {
772775
t.Fatal(err)

0 commit comments

Comments
 (0)