diff --git a/cmd/kubeadm/app/apis/kubeadm/validation/validation.go b/cmd/kubeadm/app/apis/kubeadm/validation/validation.go index 81dc867796d..3ae4462155e 100644 --- a/cmd/kubeadm/app/apis/kubeadm/validation/validation.go +++ b/cmd/kubeadm/app/apis/kubeadm/validation/validation.go @@ -568,6 +568,8 @@ func isAllowedFlag(flagName string) bool { kubeadmcmdoptions.KubeconfigDir, kubeadmcmdoptions.UploadCerts, kubeadmcmdoptions.Patches, + // TODO: https://github.com/kubernetes/kubeadm/issues/2046 remove in 1.23 + kubeadmcmdoptions.ExperimentalPatches, "print-join-command", "rootfs", "v", "log-file") if allowedFlags.Has(flagName) { return true diff --git a/cmd/kubeadm/app/cmd/options/constant.go b/cmd/kubeadm/app/cmd/options/constant.go index 7d157f719b3..dba685a7c62 100644 --- a/cmd/kubeadm/app/cmd/options/constant.go +++ b/cmd/kubeadm/app/cmd/options/constant.go @@ -144,5 +144,9 @@ const ( EtcdUpgrade = "etcd-upgrade" // Patches flag sets the folder where kubeadm component patches are stored - Patches = "experimental-patches" + Patches = "patches" + + // ExperimentalPatches (DEPRECATED) is the same as Patches + // TODO: https://github.com/kubernetes/kubeadm/issues/2046 remove in 1.23 + ExperimentalPatches = "experimental-patches" ) diff --git a/cmd/kubeadm/app/cmd/options/generic.go b/cmd/kubeadm/app/cmd/options/generic.go index fc9630dbc76..5adad595444 100644 --- a/cmd/kubeadm/app/cmd/options/generic.go +++ b/cmd/kubeadm/app/cmd/options/generic.go @@ -91,12 +91,16 @@ func AddKubeadmOtherFlags(flagSet *pflag.FlagSet, rootfsPath *string) { // AddPatchesFlag adds the --patches flag to the given flagset func AddPatchesFlag(fs *pflag.FlagSet, patchesDir *string) { - fs.StringVar(patchesDir, Patches, *patchesDir, `Path to a directory that contains files named `+ - `"target[suffix][+patchtype].extension". For example, `+ - `"kube-apiserver0+merge.yaml" or just "etcd.json". `+ - `"patchtype" can be one of "strategic", "merge" or "json" and they match the patch formats `+ - `supported by kubectl. The default "patchtype" is "strategic". "extension" must be either `+ - `"json" or "yaml". "suffix" is an optional string that can be used to determine `+ - `which patches are applied first alpha-numerically.`, - ) + const usage = `Path to a directory that contains files named ` + + `"target[suffix][+patchtype].extension". For example, ` + + `"kube-apiserver0+merge.yaml" or just "etcd.json". ` + + `"target" can be one of "kube-apiserver", "kube-controller-manager", "kube-scheduler", "etcd". ` + + `"patchtype" can be one of "strategic", "merge" or "json" and they match the patch formats ` + + `supported by kubectl. The default "patchtype" is "strategic". "extension" must be either ` + + `"json" or "yaml". "suffix" is an optional string that can be used to determine ` + + `which patches are applied first alpha-numerically.` + fs.StringVar(patchesDir, Patches, *patchesDir, usage) + // TODO: https://github.com/kubernetes/kubeadm/issues/2046 remove in 1.23 + fs.StringVar(patchesDir, ExperimentalPatches, *patchesDir, usage) + fs.MarkDeprecated(ExperimentalPatches, "This flag will be removed in a future version. Please use '--patches' instead.") } diff --git a/cmd/kubeadm/app/cmd/phases/init/controlplane.go b/cmd/kubeadm/app/cmd/phases/init/controlplane.go index e69194e60d1..8a76e9586a7 100644 --- a/cmd/kubeadm/app/cmd/phases/init/controlplane.go +++ b/cmd/kubeadm/app/cmd/phases/init/controlplane.go @@ -101,6 +101,8 @@ func getControlPlanePhaseFlags(name string) []string { options.KubernetesVersion, options.ImageRepository, options.Patches, + // TODO: https://github.com/kubernetes/kubeadm/issues/2046 remove in 1.23 + options.ExperimentalPatches, options.DryRun, } if name == "all" || name == kubeadmconstants.KubeAPIServer { diff --git a/cmd/kubeadm/app/cmd/phases/join/controlplanejoin.go b/cmd/kubeadm/app/cmd/phases/join/controlplanejoin.go index 4d3c476c0cd..a20b7b8da18 100644 --- a/cmd/kubeadm/app/cmd/phases/join/controlplanejoin.go +++ b/cmd/kubeadm/app/cmd/phases/join/controlplanejoin.go @@ -44,6 +44,8 @@ func getControlPlaneJoinPhaseFlags(name string) []string { } if name == "etcd" || name == "all" { flags = append(flags, options.Patches) + // TODO: https://github.com/kubernetes/kubeadm/issues/2046 remove in 1.23 + flags = append(flags, options.ExperimentalPatches) } if name != "mark-control-plane" { flags = append(flags, options.APIServerAdvertiseAddress) diff --git a/cmd/kubeadm/app/cmd/phases/join/controlplaneprepare.go b/cmd/kubeadm/app/cmd/phases/join/controlplaneprepare.go index 3bc2b4e011c..cdeee455adf 100644 --- a/cmd/kubeadm/app/cmd/phases/join/controlplaneprepare.go +++ b/cmd/kubeadm/app/cmd/phases/join/controlplaneprepare.go @@ -79,6 +79,8 @@ func getControlPlanePreparePhaseFlags(name string) []string { options.TokenStr, options.CertificateKey, options.Patches, + // TODO: https://github.com/kubernetes/kubeadm/issues/2046 remove in 1.23 + options.ExperimentalPatches, } case "download-certs": flags = []string{ @@ -124,6 +126,8 @@ func getControlPlanePreparePhaseFlags(name string) []string { options.CfgPath, options.ControlPlane, options.Patches, + // TODO: https://github.com/kubernetes/kubeadm/issues/2046 remove in 1.23 + options.ExperimentalPatches, } default: flags = []string{} diff --git a/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go b/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go index 1f83a155ed9..701794e5a61 100644 --- a/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go +++ b/cmd/kubeadm/app/cmd/phases/upgrade/node/controlplane.go @@ -40,6 +40,8 @@ func NewControlPlane() workflow.Phase { options.CertificateRenewal, options.EtcdUpgrade, options.Patches, + // TODO: https://github.com/kubernetes/kubeadm/issues/2046 remove in 1.23 + options.ExperimentalPatches, }, } return phase