Skip to content

Commit

Permalink
Move events command to top level
Browse files Browse the repository at this point in the history
Kubernetes-commit: 50c7ebb5b45818a4244728932ce6113c10c2d41d
  • Loading branch information
soltysh authored and k8s-publishing-bot committed Nov 10, 2022
1 parent 42cc81c commit 53106cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 0 additions & 2 deletions pkg/cmd/alpha.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/cmd/auth"
"k8s.io/kubectl/pkg/cmd/events"
cmdutil "k8s.io/kubectl/pkg/cmd/util"
"k8s.io/kubectl/pkg/util/i18n"
"k8s.io/kubectl/pkg/util/templates"
Expand All @@ -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
// from here to the CommandGroups defined by NewKubeletCommand() in cmd.go.
cmd.AddCommand(events.NewCmdEvents(f, streams))

authCmds := &cobra.Command{
Use: "auth",
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (
"k8s.io/kubectl/pkg/cmd/diff"
"k8s.io/kubectl/pkg/cmd/drain"
"k8s.io/kubectl/pkg/cmd/edit"
"k8s.io/kubectl/pkg/cmd/events"
cmdexec "k8s.io/kubectl/pkg/cmd/exec"
"k8s.io/kubectl/pkg/cmd/explain"
"k8s.io/kubectl/pkg/cmd/expose"
Expand Down Expand Up @@ -399,6 +400,7 @@ func NewKubectlCommand(o KubectlOptions) *cobra.Command {
cp.NewCmdCp(f, o.IOStreams),
auth.NewCmdAuth(f, o.IOStreams),
debug.NewCmdDebug(f, o.IOStreams),
events.NewCmdEvents(f, o.IOStreams),
},
},
{
Expand Down
14 changes: 7 additions & 7 deletions pkg/cmd/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@ import (

var (
eventsLong = templates.LongDesc(i18n.T(`
Experimental: Display events
Display events
Prints a table of the most important information about events.
You can request events for a namespace, for all namespace, or
filtered to only those pertaining to a specified resource.`))

eventsExample = templates.Examples(i18n.T(`
# List recent events in the default namespace.
kubectl alpha events
kubectl events
# 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.
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.
kubectl alpha events -oyaml
kubectl events -oyaml
# 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
Expand Down Expand Up @@ -122,7 +122,7 @@ func NewCmdEvents(restClientGetter genericclioptions.RESTClientGetter, streams g
cmd := &cobra.Command{
Use: fmt.Sprintf("events [(-o|--output=)%s] [--for TYPE/NAME] [--watch] [--event=Normal,Warning]", strings.Join(flags.PrintFlags.AllowedFormats(), "|")),
DisableFlagsInUseLine: true,
Short: i18n.T("Experimental: List events"),
Short: i18n.T("List events"),
Long: eventsLong,
Example: eventsExample,
Run: func(cmd *cobra.Command, args []string) {
Expand Down

0 comments on commit 53106cc

Please sign in to comment.