Merge pull request #98111 from pandaamanda/remove_kubectl_alpha_debug

Remove kubectl alpha debug command in 1.21

Kubernetes-commit: 055e8edfaea25bb104d6c444b0a21ca4e268b479
This commit is contained in:
Kubernetes Publisher 2021-01-21 09:57:48 -08:00
commit 3ff1afe4e8
6 changed files with 6 additions and 22 deletions

2
Godeps/Godeps.json generated
View File

@ -932,7 +932,7 @@
},
{
"ImportPath": "k8s.io/cli-runtime",
"Rev": "9547a43879a0"
"Rev": "3659b9895efa"
},
{
"ImportPath": "k8s.io/client-go",

4
go.mod
View File

@ -36,7 +36,7 @@ require (
gopkg.in/yaml.v2 v2.2.8
k8s.io/api v0.0.0-20210115125903-c873f2e8ab25
k8s.io/apimachinery v0.0.0-20210121071119-460d10991a52
k8s.io/cli-runtime v0.0.0-20201218091240-9547a43879a0
k8s.io/cli-runtime v0.0.0-20210121193827-3659b9895efa
k8s.io/client-go v0.0.0-20210121071529-b72204b2445d
k8s.io/component-base v0.0.0-20210115210250-6b412b2ef0d8
k8s.io/component-helpers v0.0.0-20210114010638-f2e8fa560240
@ -51,7 +51,7 @@ require (
replace (
k8s.io/api => k8s.io/api v0.0.0-20210115125903-c873f2e8ab25
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210121071119-460d10991a52
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20201218091240-9547a43879a0
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20210121193827-3659b9895efa
k8s.io/client-go => k8s.io/client-go v0.0.0-20210121071529-b72204b2445d
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20210116045519-b01f4fbaae20
k8s.io/component-base => k8s.io/component-base v0.0.0-20210115210250-6b412b2ef0d8

2
go.sum
View File

@ -634,7 +634,7 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20210115125903-c873f2e8ab25/go.mod h1:xpUvIW3IJYnKO2yMuT9r4zCZI1ppqiuEejNFI9eoqWo=
k8s.io/apimachinery v0.0.0-20210121071119-460d10991a52/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
k8s.io/cli-runtime v0.0.0-20201218091240-9547a43879a0/go.mod h1:YGZiEr0qwB6XSdVC2kbXtQG/+bm7+18eWKXckr167Io=
k8s.io/cli-runtime v0.0.0-20210121193827-3659b9895efa/go.mod h1:7RVyptA6kHps1rcg2hjiWbF0PKq4Z7Ui0S59wRCKAms=
k8s.io/client-go v0.0.0-20210121071529-b72204b2445d/go.mod h1:qKpEpdeFNptkCaQgvKQRqiDpcEhyGLqp0w8ALpfvaxA=
k8s.io/code-generator v0.0.0-20210116045519-b01f4fbaae20/go.mod h1:4n8UGwhxQWSnXnDBVEtX8cKaE/oMp1ui3M7yFmjT1fo=
k8s.io/component-base v0.0.0-20210115210250-6b412b2ef0d8/go.mod h1:ioM27aGQfNSdCppNxxKUoGHTWWEMcLSdPF2fyoTvGnU=

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