Skip to content

Commit d441d91

Browse files
committed
kubeadm: allow mix of --print-manifest and --config flags
The flag --print-manifest is only present for the subphases of 'kubeadm init phase addon'. It needs to be allowed to be mixed with the flag --config so that the user can pass their custom config that will affect the output of the printed manifests.
1 parent fa75c8c commit d441d91

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ func isAllowedFlag(flagName string) bool {
609609
kubeadmcmdoptions.NodeName,
610610
kubeadmcmdoptions.KubeconfigDir,
611611
kubeadmcmdoptions.UploadCerts,
612+
kubeadmcmdoptions.PrintManifest,
612613
kubeadmcmdoptions.FeatureGatesString, // TODO: remove this line when --feature-gates flag is deprecated and dropped from "kubeadm upgrade apply/plan"
613614
"api-server-manifest", "controller-manager-manifest", "scheduler-manifest", // TODO: remove this line when these flags are deprecated and dropped from "kubeadm upgrade diff"
614615
"allow-missing-template-keys", "output", "show-managed-fields",

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ func TestValidateMixedArguments(t *testing.T) {
751751
{[]string{"--config=hello", "--skip-token-print=true"}, true},
752752
{[]string{"--config=hello", "--ignore-preflight-errors=baz", "--skip-token-print"}, true},
753753
{[]string{"--config=hello", "--yes=true"}, true},
754+
{[]string{"--config=hello", "--print-manifest"}, true},
754755
// Expected to fail, --config is mixed with the --foo flag
755756
{[]string{"--config=hello", "--ignore-preflight-errors=baz", "--foo=bar"}, false},
756757
{[]string{"--config=hello", "--foo=bar"}, false},
@@ -771,6 +772,7 @@ func TestValidateMixedArguments(t *testing.T) {
771772
f.Bool("allow-experimental-upgrades", true, "upgrade flags for plan and apply command")
772773
f.Bool("skip-token-print", false, "flag not bound to config object")
773774
f.Bool("yes", false, "flag not bound to config object")
775+
f.Bool("print-manifest", false, "flag not bound to config object")
774776
f.StringVar(&cfgPath, "config", cfgPath, "Path to kubeadm config file")
775777
if err := f.Parse(rt.args); err != nil {
776778
t.Fatal(err)

0 commit comments

Comments
 (0)