From b0de341b9013a7a75fa0af1ac6d37a2015e60be9 Mon Sep 17 00:00:00 2001 From: xiongzhongliang Date: Sat, 16 Jan 2021 20:17:22 +0800 Subject: [PATCH] Remove kubectl alpha debug command in 1.21 Kubernetes-commit: e650a8a38c30ff3707292c060613acdb0714b2ec --- pkg/cmd/alpha.go | 2 -- pkg/cmd/cmd.go | 2 +- pkg/cmd/debug/debug.go | 16 +--------------- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/pkg/cmd/alpha.go b/pkg/cmd/alpha.go index 47fd0637..156e6cb5 100644 --- a/pkg/cmd/alpha.go +++ b/pkg/cmd/alpha.go @@ -20,7 +20,6 @@ import ( "github.com/spf13/cobra" "k8s.io/cli-runtime/pkg/genericclioptions" - "k8s.io/kubectl/pkg/cmd/debug" cmdutil "k8s.io/kubectl/pkg/cmd/util" "k8s.io/kubectl/pkg/util/i18n" "k8s.io/kubectl/pkg/util/templates" @@ -36,7 +35,6 @@ func NewCmdAlpha(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra. // Alpha commands should be added here. As features graduate from alpha they should move // from here to the CommandGroups defined by NewKubeletCommand() in cmd.go. - cmd.AddCommand(debug.NewCmdDebug(f, streams, true)) // NewKubeletCommand() will hide the alpha command if it has no subcommands. Overriding // the help function ensures a reasonable message if someone types the hidden command anyway. diff --git a/pkg/cmd/cmd.go b/pkg/cmd/cmd.go index 999e0e4c..ba1ac373 100644 --- a/pkg/cmd/cmd.go +++ b/pkg/cmd/cmd.go @@ -554,7 +554,7 @@ func NewKubectlCommand(in io.Reader, out, err io.Writer) *cobra.Command { proxy.NewCmdProxy(f, ioStreams), cp.NewCmdCp(f, ioStreams), auth.NewCmdAuth(f, ioStreams), - debug.NewCmdDebug(f, ioStreams, false), + debug.NewCmdDebug(f, ioStreams), }, }, { diff --git a/pkg/cmd/debug/debug.go b/pkg/cmd/debug/debug.go index d88a04a0..abcb2530 100644 --- a/pkg/cmd/debug/debug.go +++ b/pkg/cmd/debug/debug.go @@ -93,9 +93,6 @@ var ( # The container will run in the host namespaces and the host's filesystem will be mounted at /host kubectl debug node/mynode -it --image=busybox `)) - - // TODO(verb): Remove deprecated alpha invocation in 1.21 - deprecationNotice = i18n.T(`NOTE: "kubectl alpha debug" is deprecated and will be removed in release 1.21. Please use "kubectl debug" instead.`) ) var nameSuffixFunc = utilrand.String @@ -122,7 +119,6 @@ type DebugOptions struct { TTY bool attachChanged bool - deprecatedInvocation bool shareProcessedChanged bool podClient corev1client.PodsGetter @@ -141,7 +137,7 @@ func NewDebugOptions(streams genericclioptions.IOStreams) *DebugOptions { } // NewCmdDebug returns a cobra command that runs kubectl debug. -func NewCmdDebug(f cmdutil.Factory, streams genericclioptions.IOStreams, deprecatedInvocation bool) *cobra.Command { +func NewCmdDebug(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { o := NewDebugOptions(streams) cmd := &cobra.Command{ @@ -155,12 +151,6 @@ func NewCmdDebug(f cmdutil.Factory, streams genericclioptions.IOStreams, depreca cmdutil.CheckErr(o.Validate(cmd)) cmdutil.CheckErr(o.Run(f, cmd)) }, - Hidden: deprecatedInvocation, - } - - o.deprecatedInvocation = deprecatedInvocation - if deprecatedInvocation { - cmd.Long = fmt.Sprintf("%s\n\n%s", deprecationNotice, debugLong) } addDebugFlags(cmd, o) @@ -189,10 +179,6 @@ func addDebugFlags(cmd *cobra.Command, opt *DebugOptions) { func (o *DebugOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error { var err error - if o.deprecatedInvocation { - cmd.Printf("%s\n\n", deprecationNotice) - } - o.PullPolicy = corev1.PullPolicy(cmdutil.GetFlagString(cmd, "image-pull-policy")) // Arguments