Merge pull request #85044 from neolit123/1.17-deprecate-cri-socket-upgrade

kubeadm: remove the deprecated "--cri-socket" flag for "upgrade apply"
This commit is contained in:
Kubernetes Prow Robot 2019-11-11 12:56:37 -08:00 committed by GitHub
commit fc0bf06983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,6 @@ import (
"k8s.io/klog"
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/kubernetes/cmd/kubeadm/app/features"
"k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade"
@ -49,7 +48,6 @@ type applyFlags struct {
dryRun bool
etcdUpgrade bool
renewCerts bool
criSocket string
imagePullTimeout time.Duration
kustomizeDir string
}
@ -66,7 +64,6 @@ func NewCmdApply(apf *applyPlanFlags) *cobra.Command {
imagePullTimeout: defaultImagePullTimeout,
etcdUpgrade: true,
renewCerts: true,
// Don't set criSocket to a default value here, as this will override the setting in the stored config in RunApply below.
}
cmd := &cobra.Command{
@ -94,10 +91,6 @@ func NewCmdApply(apf *applyPlanFlags) *cobra.Command {
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.")
options.AddKustomizePodsFlag(cmd.Flags(), &flags.kustomizeDir)
// The CRI socket flag is deprecated here, since it should be taken from the NodeRegistrationOptions for the current
// node instead of the command line. This prevents errors by the users (such as attempts to use wrong CRI during upgrade).
cmdutil.AddCRISocketFlag(cmd.Flags(), &flags.criSocket)
cmd.Flags().MarkDeprecated(options.NodeCRISocket, "This flag is deprecated. Please, avoid using it.")
return cmd
}
@ -123,11 +116,6 @@ func runApply(flags *applyFlags, userVersion string) error {
return err
}
if len(flags.criSocket) != 0 {
fmt.Println("[upgrade/apply] Respecting the --cri-socket flag that is set with higher priority than the config file.")
cfg.NodeRegistration.CRISocket = flags.criSocket
}
// Validate requested and validate actual version
klog.V(1).Infoln("[upgrade/apply] validating requested and actual version")
if err := configutil.NormalizeKubernetesVersion(&cfg.ClusterConfiguration); err != nil {