mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #125566 from xmudrii/kubeadm-yes
kubeadm: Add '--yes' flag to the list of allowed flags
This commit is contained in:
commit
7b359a2f9e
@ -609,7 +609,7 @@ func isAllowedFlag(flagName string) bool {
|
|||||||
kubeadmcmdoptions.NodeName,
|
kubeadmcmdoptions.NodeName,
|
||||||
kubeadmcmdoptions.KubeconfigDir,
|
kubeadmcmdoptions.KubeconfigDir,
|
||||||
kubeadmcmdoptions.UploadCerts,
|
kubeadmcmdoptions.UploadCerts,
|
||||||
"print-join-command", "rootfs", "v", "log-file")
|
"print-join-command", "rootfs", "v", "log-file", "yes")
|
||||||
if allowedFlags.Has(flagName) {
|
if allowedFlags.Has(flagName) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -749,9 +749,11 @@ func TestValidateMixedArguments(t *testing.T) {
|
|||||||
// Expected to succeed, --config is mixed with skip-* flags only or no other flags
|
// 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", "--skip-token-print=true"}, true},
|
||||||
{[]string{"--config=hello", "--ignore-preflight-errors=baz", "--skip-token-print"}, 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
|
// Expected to fail, --config is mixed with the --foo flag
|
||||||
{[]string{"--config=hello", "--ignore-preflight-errors=baz", "--foo=bar"}, false},
|
{[]string{"--config=hello", "--ignore-preflight-errors=baz", "--foo=bar"}, false},
|
||||||
{[]string{"--config=hello", "--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
|
// Expected to fail, --config is mixed with the upgrade related flag
|
||||||
{[]string{"--config=hello", "--allow-experimental-upgrades"}, false},
|
{[]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.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("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("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")
|
f.StringVar(&cfgPath, "config", cfgPath, "Path to kubeadm config file")
|
||||||
if err := f.Parse(rt.args); err != nil {
|
if err := f.Parse(rt.args); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user