Commit Graph

12 Commits

Author SHA1 Message Date
Arda Güçlü 608a0553d7 Use generic sets rather than deprecated sets.String
Kubernetes-commit: c3f15fd707a092e6cb7d96b84b81ada1f118d759
2024-11-21 13:22:39 +03:00
Josh Soref 209732ca71 chore: Order ScalingReplicaSet message from->to
* change format of event
* include `from 0` for new replicas
* update describe tests to reflect current output

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>

Kubernetes-commit: 502c05ed019573e8ed43c412f739882eec0f5f7c
2024-05-24 12:18:06 -04:00
ithrael 84a37fbc5d fix(test): fix error handling condition in test
Kubernetes-commit: d680bc540b5703510c95b9290bfb4317edc7b2e9
2023-08-27 21:11:39 +08:00
Abid Malik 64fc8b1f67 fixes the issue in the documentation of kubectl events
Signed-off-by: Abid Malik <AbidMunirMalik@gmail.com>

Kubernetes-commit: d8c145d20da7906722798218652583dea34b48bb
2023-07-13 13:10:33 -04:00
ithrael 296dae746e fix(kubectl): kubectl events doesn't filter events by GroupVersion for resource with full name
Kubernetes-commit: 28621f1eb3f3a9ba212c844db4696f7f17450942
2023-08-23 11:34:44 +08:00
Andrea Hoffer b676723184 Update CLI help text for grammar and consistency
Kubernetes-commit: a86380c7813a6d0cfa248c9165c878038730526a
2023-06-12 15:55:59 -04:00
Arda Güçlü 3f05cfcd78 Migrate genericclioptions.IOStreams usage to genericiooptions
Kubernetes-commit: 00c30941260a27e6929aef84c7fdbc8f1508518c
2023-04-05 14:07:46 +03:00
Arda Güçlü 5de8e8f539 kubectl events: Support fully qualified names for --for flag
Users can pass resources into `kubectl events` command via `--for` flag,
if they have desire to only get events for the resource they specify.

However, current `kubectl events` does not support passing fully qualified
names(e.g. `replicasets.apps`, `cronjobs.v1.batch`, etc.). This PR adds support
for this.

Kubernetes-commit: 457bb58ebbf5a863ce30f51c53a84bc41c2380dc
2023-03-31 12:34:00 +03:00
Maciej Szulik 53106cc99b Move events command to top level
Kubernetes-commit: 50c7ebb5b45818a4244728932ce6113c10c2d41d
2022-11-10 14:32:14 +01:00
David Leadbeater 8e2918ab8b Escape terminal special characters in kubectl (#112553)
* Escape terminal special characters in kubectl

* Add escaping for kubectl alpha events

Kubernetes-commit: dad0e937c0f76344363eb691b2668490ffef8537
2022-10-30 16:29:24 +00:00
Arda Güçlü fc1c4dafec Add new flags into alpha events
In order to promote kubectl alpha events to beta,
it should at least support flags which is already
supported by kubectl get events as well as new flags.

This PR adds;

--output: json|yaml support and does essential refactorings to
integrate other printing options easier in the future.

--no-headers: kubectl get events can hide headers when this flag is set for default printing.
Adds this ability to hide headers also for kubectl alpha events.
This flag has no effect when output is json or yaml for both commands.

--types: This will be used to filter certain events to be printed and
discard others(default behavior is same with --event=Normal,Warning).

Kubernetes-commit: 63b8684cd32f96f3a1e5c5a5fd05e8194f2140fc
2022-05-10 13:09:59 +03:00
Bryan Boreham 0a152f103a 'kubectl events' command (#99557)
* Basic scaffolding for kubectl events command

* Simple implementation of 'kubectl events'

* Print event fields

Borrowing code from 'kubectl describe'

* Sort events before printing

* Make output more like 'kubectl get events'

Print namespace if fetching from all

* Refactor: extract print functions

To make it easier to add watch function next.

* Implement watch for new events

Run the list function same as before, so those events come out in order,
then watch from the ResourceVersion after the last event.

* Clear up some lint warnings

* Update description and example text

* refactor: introduce a listOptions variable

* Implement --for option

splitResourceTypeName() function borrowed from cli-runtime because we
need similar behaviour to Builder.ResourceNames(), but applying to
Event.InvolvedObject.

* Add kubectl/pkg/cmd/events to vendor/modules.txt

* Add back cmdutil.Factory

Needed in NewCmdAlpha to construct the 'events' command

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Fix lint

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Make package alias go-cromulent

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Use genericclioptions.RESTClientGetter instead of cmdutil.Factory

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Decode object parameter to GroupVersionKind and name

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Merge two files into one

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Include example for --for option

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Fix inconsistent option name in error message

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Remove unnecessary Validate call

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Use fields from event series

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Support chunking of list of events

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Use watchtools utility to receive watch events

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Split struct into flags and options

Flags represents the inputs from the CLI; options are what the running
command needs. This structure parallels the 'wait' command, and should
be easier to write tests for.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Add some parameters to usage string

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Do only one of list or watch

We tried to print the list first then start a watch after the last
event, but sometimes the server will return "watch is too old" on that
ResourceVersion.
Instead, if we need to watch just start it from the beginning.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Print message if no events found

Also, if watching, don't print the headings until the first event
arrives.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

Kubernetes-commit: a988182f595af64bc007ba9162509e089c36fd89
2021-10-29 17:13:38 +00:00