Remove kubectl alpha debug command in 1.21

Kubernetes-commit: e650a8a38c30ff3707292c060613acdb0714b2ec
This commit is contained in:
xiongzhongliang 2021-01-16 20:17:22 +08:00 committed by Kubernetes Publisher
parent bd9f627b51
commit b0de341b90
3 changed files with 2 additions and 18 deletions

View File

@ -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.

View File

@ -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),
},
},
{

View File

@ -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