Remove kubectl alpha debug command in 1.21
Kubernetes-commit: e650a8a38c30ff3707292c060613acdb0714b2ec
This commit is contained in:
parent
bd9f627b51
commit
b0de341b90
|
@ -20,7 +20,6 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||||
"k8s.io/kubectl/pkg/cmd/debug"
|
|
||||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||||
"k8s.io/kubectl/pkg/util/i18n"
|
"k8s.io/kubectl/pkg/util/i18n"
|
||||||
"k8s.io/kubectl/pkg/util/templates"
|
"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
|
// 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.
|
// 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
|
// 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.
|
// the help function ensures a reasonable message if someone types the hidden command anyway.
|
||||||
|
|
|
@ -554,7 +554,7 @@ func NewKubectlCommand(in io.Reader, out, err io.Writer) *cobra.Command {
|
||||||
proxy.NewCmdProxy(f, ioStreams),
|
proxy.NewCmdProxy(f, ioStreams),
|
||||||
cp.NewCmdCp(f, ioStreams),
|
cp.NewCmdCp(f, ioStreams),
|
||||||
auth.NewCmdAuth(f, ioStreams),
|
auth.NewCmdAuth(f, ioStreams),
|
||||||
debug.NewCmdDebug(f, ioStreams, false),
|
debug.NewCmdDebug(f, ioStreams),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,9 +93,6 @@ var (
|
||||||
# The container will run in the host namespaces and the host's filesystem will be mounted at /host
|
# 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
|
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
|
var nameSuffixFunc = utilrand.String
|
||||||
|
@ -122,7 +119,6 @@ type DebugOptions struct {
|
||||||
TTY bool
|
TTY bool
|
||||||
|
|
||||||
attachChanged bool
|
attachChanged bool
|
||||||
deprecatedInvocation bool
|
|
||||||
shareProcessedChanged bool
|
shareProcessedChanged bool
|
||||||
|
|
||||||
podClient corev1client.PodsGetter
|
podClient corev1client.PodsGetter
|
||||||
|
@ -141,7 +137,7 @@ func NewDebugOptions(streams genericclioptions.IOStreams) *DebugOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCmdDebug returns a cobra command that runs kubectl debug.
|
// 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)
|
o := NewDebugOptions(streams)
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -155,12 +151,6 @@ func NewCmdDebug(f cmdutil.Factory, streams genericclioptions.IOStreams, depreca
|
||||||
cmdutil.CheckErr(o.Validate(cmd))
|
cmdutil.CheckErr(o.Validate(cmd))
|
||||||
cmdutil.CheckErr(o.Run(f, 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)
|
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 {
|
func (o *DebugOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if o.deprecatedInvocation {
|
|
||||||
cmd.Printf("%s\n\n", deprecationNotice)
|
|
||||||
}
|
|
||||||
|
|
||||||
o.PullPolicy = corev1.PullPolicy(cmdutil.GetFlagString(cmd, "image-pull-policy"))
|
o.PullPolicy = corev1.PullPolicy(cmdutil.GetFlagString(cmd, "image-pull-policy"))
|
||||||
|
|
||||||
// Arguments
|
// Arguments
|
||||||
|
|
Loading…
Reference in New Issue