Move events command to top level

Kubernetes-commit: 50c7ebb5b45818a4244728932ce6113c10c2d41d
This commit is contained in:
Maciej Szulik 2022-11-10 14:32:14 +01:00 committed by Kubernetes Publisher
parent 42cc81c0ec
commit 53106cc99b
3 changed files with 9 additions and 9 deletions

View File

@ -21,7 +21,6 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/cmd/auth" "k8s.io/kubectl/pkg/cmd/auth"
"k8s.io/kubectl/pkg/cmd/events"
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"
@ -37,7 +36,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(events.NewCmdEvents(f, streams))
authCmds := &cobra.Command{ authCmds := &cobra.Command{
Use: "auth", Use: "auth",

View File

@ -50,6 +50,7 @@ import (
"k8s.io/kubectl/pkg/cmd/diff" "k8s.io/kubectl/pkg/cmd/diff"
"k8s.io/kubectl/pkg/cmd/drain" "k8s.io/kubectl/pkg/cmd/drain"
"k8s.io/kubectl/pkg/cmd/edit" "k8s.io/kubectl/pkg/cmd/edit"
"k8s.io/kubectl/pkg/cmd/events"
cmdexec "k8s.io/kubectl/pkg/cmd/exec" cmdexec "k8s.io/kubectl/pkg/cmd/exec"
"k8s.io/kubectl/pkg/cmd/explain" "k8s.io/kubectl/pkg/cmd/explain"
"k8s.io/kubectl/pkg/cmd/expose" "k8s.io/kubectl/pkg/cmd/expose"
@ -399,6 +400,7 @@ func NewKubectlCommand(o KubectlOptions) *cobra.Command {
cp.NewCmdCp(f, o.IOStreams), cp.NewCmdCp(f, o.IOStreams),
auth.NewCmdAuth(f, o.IOStreams), auth.NewCmdAuth(f, o.IOStreams),
debug.NewCmdDebug(f, o.IOStreams), debug.NewCmdDebug(f, o.IOStreams),
events.NewCmdEvents(f, o.IOStreams),
}, },
}, },
{ {

View File

@ -48,7 +48,7 @@ import (
var ( var (
eventsLong = templates.LongDesc(i18n.T(` eventsLong = templates.LongDesc(i18n.T(`
Experimental: Display events Display events
Prints a table of the most important information about events. Prints a table of the most important information about events.
You can request events for a namespace, for all namespace, or You can request events for a namespace, for all namespace, or
@ -56,19 +56,19 @@ var (
eventsExample = templates.Examples(i18n.T(` eventsExample = templates.Examples(i18n.T(`
# List recent events in the default namespace. # List recent events in the default namespace.
kubectl alpha events kubectl events
# List recent events in all namespaces. # List recent events in all namespaces.
kubectl alpha events --all-namespaces kubectl events --all-namespaces
# List recent events for the specified pod, then wait for more events and list them as they arrive. # List recent events for the specified pod, then wait for more events and list them as they arrive.
kubectl alpha events --for pod/web-pod-13je7 --watch kubectl events --for pod/web-pod-13je7 --watch
# List recent events in given format. Supported ones, apart from default, are json and yaml. # List recent events in given format. Supported ones, apart from default, are json and yaml.
kubectl alpha events -oyaml kubectl events -oyaml
# List recent only events in given event types # List recent only events in given event types
kubectl alpha events --types=Warning,Normal`)) kubectl events --types=Warning,Normal`))
) )
// EventsFlags directly reflect the information that CLI is gathering via flags. They will be converted to Options, which // EventsFlags directly reflect the information that CLI is gathering via flags. They will be converted to Options, which
@ -122,7 +122,7 @@ func NewCmdEvents(restClientGetter genericclioptions.RESTClientGetter, streams g
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: fmt.Sprintf("events [(-o|--output=)%s] [--for TYPE/NAME] [--watch] [--event=Normal,Warning]", strings.Join(flags.PrintFlags.AllowedFormats(), "|")), Use: fmt.Sprintf("events [(-o|--output=)%s] [--for TYPE/NAME] [--watch] [--event=Normal,Warning]", strings.Join(flags.PrintFlags.AllowedFormats(), "|")),
DisableFlagsInUseLine: true, DisableFlagsInUseLine: true,
Short: i18n.T("Experimental: List events"), Short: i18n.T("List events"),
Long: eventsLong, Long: eventsLong,
Example: eventsExample, Example: eventsExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {