Merge pull request #116510 from flant/whoami-beta
Promote whoami kubectl command Kubernetes-commit: 4a7ba056911dd822917b00ecc4b6fa77e721bbd5
This commit is contained in:
commit
ff0a58d6f5
12
go.mod
12
go.mod
|
|
@ -30,10 +30,10 @@ require (
|
|||
github.com/stretchr/testify v1.8.1
|
||||
golang.org/x/sys v0.5.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
k8s.io/api v0.0.0-20230310084044-182afbd21219
|
||||
k8s.io/apimachinery v0.0.0-20230310083535-8fccf3d61224
|
||||
k8s.io/api v0.0.0-20230313011535-19ee583d5657
|
||||
k8s.io/apimachinery v0.0.0-20230310204503-273f86d1012f
|
||||
k8s.io/cli-runtime v0.0.0-20230310093857-5c6f9c63192f
|
||||
k8s.io/client-go v0.0.0-20230310170151-6df09021f998
|
||||
k8s.io/client-go v0.0.0-20230313012152-012954e4d5d6
|
||||
k8s.io/component-base v0.0.0-20230310085212-d69652187fff
|
||||
k8s.io/component-helpers v0.0.0-20230310085329-cb3213391b8c
|
||||
k8s.io/klog/v2 v2.90.1
|
||||
|
|
@ -91,10 +91,10 @@ require (
|
|||
)
|
||||
|
||||
replace (
|
||||
k8s.io/api => k8s.io/api v0.0.0-20230310084044-182afbd21219
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20230310083535-8fccf3d61224
|
||||
k8s.io/api => k8s.io/api v0.0.0-20230313011535-19ee583d5657
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20230310204503-273f86d1012f
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20230310093857-5c6f9c63192f
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20230310170151-6df09021f998
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20230313012152-012954e4d5d6
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20230310082919-4a4a238d07ff
|
||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20230310085212-d69652187fff
|
||||
k8s.io/component-helpers => k8s.io/component-helpers v0.0.0-20230310085329-cb3213391b8c
|
||||
|
|
|
|||
12
go.sum
12
go.sum
|
|
@ -531,14 +531,14 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
k8s.io/api v0.0.0-20230310084044-182afbd21219 h1:Zi16ywjzp2CqeHJZoz3N0RlFu20NqeuIzqY1RkRg4FU=
|
||||
k8s.io/api v0.0.0-20230310084044-182afbd21219/go.mod h1:BufeAXF75avqFSWCYqXkvwYrwI4ZAem3uLWUZFS14hw=
|
||||
k8s.io/apimachinery v0.0.0-20230310083535-8fccf3d61224 h1:LhE0BNPRZYIEMmTBywXwvw3P3YtfPIo3xRefHYrbR0s=
|
||||
k8s.io/apimachinery v0.0.0-20230310083535-8fccf3d61224/go.mod h1:RWA+8iKvi6iwtPZ0MMwtZSlZRiH+SnmQH2SbXJrVDPQ=
|
||||
k8s.io/api v0.0.0-20230313011535-19ee583d5657 h1:7hP13dy95USecJLpO3d/yllQXI+SNLRRGM7PwTgymWI=
|
||||
k8s.io/api v0.0.0-20230313011535-19ee583d5657/go.mod h1:mC4uNxaqlroZsbbPGKGEBST4KfC7f1enRIJHulFvlU0=
|
||||
k8s.io/apimachinery v0.0.0-20230310204503-273f86d1012f h1:SMeRbv27Q4QvyAGw6IkqXzluMMJnL3gtBpk1W3fCao0=
|
||||
k8s.io/apimachinery v0.0.0-20230310204503-273f86d1012f/go.mod h1:RWA+8iKvi6iwtPZ0MMwtZSlZRiH+SnmQH2SbXJrVDPQ=
|
||||
k8s.io/cli-runtime v0.0.0-20230310093857-5c6f9c63192f h1:u47kCmJLLP6yqafHhGlUS0xEnD+nrcSr6ZvXKnMD/9M=
|
||||
k8s.io/cli-runtime v0.0.0-20230310093857-5c6f9c63192f/go.mod h1:5DoshHAhpomXS+3lFu3kcyXmaEbK7Rs6UVmdz+bDafo=
|
||||
k8s.io/client-go v0.0.0-20230310170151-6df09021f998 h1:gxGnQVRtt2NmwPYoPu+6xp+Y1lB3srWAA/kkXTQmQUQ=
|
||||
k8s.io/client-go v0.0.0-20230310170151-6df09021f998/go.mod h1:seT1S8LUx48CIppmquME8d52oZQTiI2CX577lxB8cXA=
|
||||
k8s.io/client-go v0.0.0-20230313012152-012954e4d5d6 h1:KzluWphPH3AM64rfiDN2AQdITPwNGMrp9YMg4OFyQIg=
|
||||
k8s.io/client-go v0.0.0-20230313012152-012954e4d5d6/go.mod h1:uyV7+FBRFiQ1zJrWtp+2r08/6sK1b543Vyrb8FermHE=
|
||||
k8s.io/component-base v0.0.0-20230310085212-d69652187fff h1:xIjiK+aBPzY5Mqh/lFvmlfgvS1O35/hyhPw/LTmYyNA=
|
||||
k8s.io/component-base v0.0.0-20230310085212-d69652187fff/go.mod h1:Z2LoX89dLUu0xNvMSY057kEMNJjD/XD53nEyD0Lji2s=
|
||||
k8s.io/component-helpers v0.0.0-20230310085329-cb3213391b8c h1:qnXD7igEVg82/LZYld7bs2tJvYa4ODJkaGohe9Hy4yA=
|
||||
|
|
|
|||
|
|
@ -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 New Issue