Merge pull request #125779 from SataQiu/fix-upgrade-diff-20240628

kubeadm: fix a bug where the path of the manifest can not be specified when 'upgrade diff' specified a config file
This commit is contained in:
Kubernetes Prow Robot 2024-06-28 07:04:00 -07:00 committed by GitHub
commit 5e331569e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View File

@ -609,6 +609,7 @@ func isAllowedFlag(flagName string) bool {
kubeadmcmdoptions.NodeName,
kubeadmcmdoptions.KubeconfigDir,
kubeadmcmdoptions.UploadCerts,
"api-server-manifest", "controller-manager-manifest", "scheduler-manifest", // TODO: remove this line when these flags are deprecated and dropped from "kubeadm upgrade diff"
"print-join-command", "rootfs", "v", "log-file", "yes")
if allowedFlags.Has(flagName) {
return true

View File

@ -89,8 +89,11 @@ func newCmdDiff(out io.Writer) *cobra.Command {
options.AddKubeConfigFlag(cmd.Flags(), &flags.kubeConfigPath)
options.AddConfigFlag(cmd.Flags(), &flags.cfgPath)
cmd.Flags().StringVar(&flags.apiServerManifestPath, "api-server-manifest", defaultAPIServerManifestPath, "path to API server manifest")
cmd.Flags().MarkDeprecated("api-server-manifest", "This flag is deprecated and will be removed in a future release.")
cmd.Flags().StringVar(&flags.controllerManagerManifestPath, "controller-manager-manifest", defaultControllerManagerManifestPath, "path to controller manifest")
cmd.Flags().MarkDeprecated("controller-manager-manifest", "This flag is deprecated and will be removed in a future release.")
cmd.Flags().StringVar(&flags.schedulerManifestPath, "scheduler-manifest", defaultSchedulerManifestPath, "path to scheduler manifest")
cmd.Flags().MarkDeprecated("scheduler-manifest", "This flag is deprecated and will be removed in a future release.")
cmd.Flags().IntVarP(&flags.contextLines, "context-lines", "c", 3, "How many lines of context in the diff")
return cmd