kubeadm: Add '--yes' flag to the list of allowed flags

Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
This commit is contained in:
Marko Mudrinić 2024-06-18 13:04:17 +02:00
parent efef32652a
commit 33466a6606
No known key found for this signature in database
2 changed files with 4 additions and 1 deletions

View File

@ -609,7 +609,7 @@ func isAllowedFlag(flagName string) bool {
kubeadmcmdoptions.NodeName,
kubeadmcmdoptions.KubeconfigDir,
kubeadmcmdoptions.UploadCerts,
"print-join-command", "rootfs", "v", "log-file")
"print-join-command", "rootfs", "v", "log-file", "yes")
if allowedFlags.Has(flagName) {
return true
}

View File

@ -749,9 +749,11 @@ func TestValidateMixedArguments(t *testing.T) {
// Expected to succeed, --config is mixed with skip-* flags only or no other flags
{[]string{"--config=hello", "--skip-token-print=true"}, true},
{[]string{"--config=hello", "--ignore-preflight-errors=baz", "--skip-token-print"}, true},
{[]string{"--config=hello", "--yes=true"}, true},
// Expected to fail, --config is mixed with the --foo flag
{[]string{"--config=hello", "--ignore-preflight-errors=baz", "--foo=bar"}, false},
{[]string{"--config=hello", "--foo=bar"}, false},
{[]string{"--config=hello", "--yes=true", "--foo=bar"}, false},
// Expected to fail, --config is mixed with the upgrade related flag
{[]string{"--config=hello", "--allow-experimental-upgrades"}, false},
}
@ -767,6 +769,7 @@ func TestValidateMixedArguments(t *testing.T) {
f.StringSliceVar(&ignorePreflightErrors, "ignore-preflight-errors", ignorePreflightErrors, "flag not bound to config object")
f.Bool("allow-experimental-upgrades", true, "upgrade flags for plan and apply command")
f.Bool("skip-token-print", false, "flag not bound to config object")
f.Bool("yes", false, "flag not bound to config object")
f.StringVar(&cfgPath, "config", cfgPath, "Path to kubeadm config file")
if err := f.Parse(rt.args); err != nil {
t.Fatal(err)