mirror of
https://github.com/kubernetes/kubectl.git
synced 2026-05-28 04:35:50 -04:00
Promote whoami kubectl command
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com> Kubernetes-commit: c2cadd2b60424d26678b72506e377dfbf12b9876
This commit is contained in:
parent
cd74b8cb4d
commit
e0b4d10785
3 changed files with 3 additions and 15 deletions
|
|
@ -20,7 +20,6 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
|
||||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||
"k8s.io/kubectl/pkg/cmd/auth"
|
||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||
"k8s.io/kubectl/pkg/util/i18n"
|
||||
"k8s.io/kubectl/pkg/util/templates"
|
||||
|
|
@ -34,18 +33,6 @@ func NewCmdAlpha(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.
|
|||
Long: templates.LongDesc(i18n.T("These commands correspond to alpha features that are not enabled in Kubernetes clusters by default.")),
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
||||
authCmds := &cobra.Command{
|
||||
Use: "auth",
|
||||
Short: "Inspect authorization",
|
||||
Long: `Inspect authorization`,
|
||||
Run: cmdutil.DefaultSubCommandRun(streams.ErrOut),
|
||||
}
|
||||
cmd.AddCommand(authCmds)
|
||||
authCmds.AddCommand(auth.NewCmdWhoAmI(f, streams))
|
||||
|
||||
// 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.
|
||||
if !cmd.HasAvailableSubCommands() {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ func NewCmdAuth(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
|
|||
|
||||
cmds.AddCommand(NewCmdCanI(f, streams))
|
||||
cmds.AddCommand(NewCmdReconcile(f, streams))
|
||||
cmds.AddCommand(NewCmdWhoAmI(f, streams))
|
||||
|
||||
return cmds
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,10 +121,10 @@ var (
|
|||
|
||||
whoAmIExample = templates.Examples(`
|
||||
# Get your subject attributes.
|
||||
kubectl alpha auth whoami
|
||||
kubectl auth whoami
|
||||
|
||||
# Get your subject attributes in JSON format.
|
||||
kubectl alpha auth whoami -o json
|
||||
kubectl auth whoami -o json
|
||||
`)
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue