* 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
The new releases fix logging of KObj in JSON output: klog implements the new
logr.Marshaler interface and zapr uses it instead of Stringer when logging the
ObjectRef created by KObj.
Kubernetes-commit: 169e8b65a00b45ef8bbc7a14cd985df1c835953b
This commit teaches the completion function to repeat resource names
when supported by the command. The logic checks if a resource name
has already been specified by the user and does not include it again
when repeating the completion.
For example, the get command can receive multiple pods names, therefore
with this commit we have:
kubectl get pod pod1 [tab]
will provide completion of pod names again, but not show 'pod1' since
it is already part of the command-line.
The improvement affects the following commands:
- annotate
- apply edit-last-applied
- apply view-last-applied
- autoscale
- delete
- describe
- edit
- expose
- get
- label
- patch
- rollout history
- rollout pause
- rollout restart
- rollout resume
- rollout undo
- scale
- taint
Note that "rollout status" only accepts a single resource name, unlike
the other "rollout ..." commands; this required the creation of a
special completion function that did not repeat just for that case.
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
Kubernetes-commit: 7aa5cb40316dbeb970250ee0835fbd597fd19a20
I initially noticed a minor typo in --tty, and while fixing it,
I noticed small discrepancies in some other flags. These minor
changes should make the 'kubectl run' flag help slightly more
correct (hopefully). 🙂
Kubernetes-commit: 7ca336caf383bca9848cab64657a92b025f34312
This PR introduces new prune and it's dependent parameters to simulate
`kubectl apply --prune` command.
Kubernetes-commit: 56c19f1056ad6d4a4bb926fe90e37f56a31c4e2f
When doing completion for arguments or flags for a plugin, kubectl will
call "kubectl_complete-<plugin>" to obtain the list of completions.
For example, for "krew" plugin, when the user triggers completion using:
$ kubectl krew <tab><tab>
kubectl will look for an executable file called "kubectl_complete-krew".
This file should print the list of valid completions for the plugin to
stdout. Using cobra.ShellCompDirective as the last line of the output
is supported as is done by Cobra.
We also clear global flags when doing plugin completion because plugins
don't necessarily accept the global kubectl flags. If some plugins do,
they will need to include such flags in their kubectl_complete-<plugin>
output.
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
Kubernetes-commit: befc8da7efa5d961d9ade4eadc706292c7ca5a64
to keep a count of the pods that have the ready condition.
Also:
- Add feature gate JobReadyPods.
- Add Ready to describe.
Change-Id: Ib934730a430a8e2a2f485671e345fe2330006939
Kubernetes-commit: 1bff5eb44d9897e12aff3ea10f5a856580158278