Merge pull request #126740 from neolit123/1.32-allow-config-and-print-manifest

kubeadm: allow mix of --print-manifest and --config flags
This commit is contained in:
Kubernetes Prow Robot 2024-08-26 05:40:41 +01:00 committed by GitHub
commit 2f3e7f515f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View File

@ -609,6 +609,7 @@ func isAllowedFlag(flagName string) bool {
kubeadmcmdoptions.NodeName,
kubeadmcmdoptions.KubeconfigDir,
kubeadmcmdoptions.UploadCerts,
kubeadmcmdoptions.PrintManifest,
kubeadmcmdoptions.FeatureGatesString, // TODO: remove this line when --feature-gates flag is deprecated and dropped from "kubeadm upgrade apply/plan"
"api-server-manifest", "controller-manager-manifest", "scheduler-manifest", // TODO: remove this line when these flags are deprecated and dropped from "kubeadm upgrade diff"
"allow-missing-template-keys", "output", "show-managed-fields",

View File

@ -751,6 +751,7 @@ func TestValidateMixedArguments(t *testing.T) {
{[]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},
{[]string{"--config=hello", "--print-manifest"}, 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},
@ -771,6 +772,7 @@ func TestValidateMixedArguments(t *testing.T) {
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.Bool("print-manifest", 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)