kubeadm: remove the deprecated flag '--image-pull-timeout' for 'kubeadm upgrade apply' command

This commit is contained in:
SataQiu 2021-05-18 20:34:05 +08:00
parent 5c58620118
commit 15dcc83cec

View File

@ -18,7 +18,6 @@ package upgrade
import ( import (
"fmt" "fmt"
"time"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -38,10 +37,6 @@ import (
utilsexec "k8s.io/utils/exec" utilsexec "k8s.io/utils/exec"
) )
const (
defaultImagePullTimeout = 15 * time.Minute
)
// applyFlags holds the information about the flags that can be passed to apply // applyFlags holds the information about the flags that can be passed to apply
type applyFlags struct { type applyFlags struct {
*applyPlanFlags *applyPlanFlags
@ -51,7 +46,6 @@ type applyFlags struct {
dryRun bool dryRun bool
etcdUpgrade bool etcdUpgrade bool
renewCerts bool renewCerts bool
imagePullTimeout time.Duration
patchesDir string patchesDir string
} }
@ -64,7 +58,6 @@ func (f *applyFlags) sessionIsInteractive() bool {
func newCmdApply(apf *applyPlanFlags) *cobra.Command { func newCmdApply(apf *applyPlanFlags) *cobra.Command {
flags := &applyFlags{ flags := &applyFlags{
applyPlanFlags: apf, applyPlanFlags: apf,
imagePullTimeout: defaultImagePullTimeout,
etcdUpgrade: true, etcdUpgrade: true,
renewCerts: true, renewCerts: true,
} }
@ -86,9 +79,6 @@ func newCmdApply(apf *applyPlanFlags) *cobra.Command {
cmd.Flags().BoolVar(&flags.dryRun, options.DryRun, flags.dryRun, "Do not change any state, just output what actions would be performed.") cmd.Flags().BoolVar(&flags.dryRun, options.DryRun, flags.dryRun, "Do not change any state, just output what actions would be performed.")
cmd.Flags().BoolVar(&flags.etcdUpgrade, "etcd-upgrade", flags.etcdUpgrade, "Perform the upgrade of etcd.") cmd.Flags().BoolVar(&flags.etcdUpgrade, "etcd-upgrade", flags.etcdUpgrade, "Perform the upgrade of etcd.")
cmd.Flags().BoolVar(&flags.renewCerts, options.CertificateRenewal, flags.renewCerts, "Perform the renewal of certificates used by component changed during upgrades.") cmd.Flags().BoolVar(&flags.renewCerts, options.CertificateRenewal, flags.renewCerts, "Perform the renewal of certificates used by component changed during upgrades.")
cmd.Flags().DurationVar(&flags.imagePullTimeout, "image-pull-timeout", flags.imagePullTimeout, "The maximum amount of time to wait for the control plane pods to be downloaded.")
// TODO: The flag was deprecated in 1.19; remove the flag following a GA deprecation policy of 12 months or 2 releases (whichever is longer)
cmd.Flags().MarkDeprecated("image-pull-timeout", "This flag is deprecated and will be removed in a future version.")
options.AddPatchesFlag(cmd.Flags(), &flags.patchesDir) options.AddPatchesFlag(cmd.Flags(), &flags.patchesDir)
return cmd return cmd