Commit Graph

22 Commits

Author SHA1 Message Date
Ritikaa96 ff551a76e3 correcting link to krew install
Signed-off-by: Ritikaa96 <ritika@india.nec.com>

Kubernetes-commit: 23ac0be7adf9212bec4771a351417a1142520485
2024-05-27 16:52:19 +05:30
Ritikaa96 8941dd6b94 added name-only and examples in the kubectl plugin help
Signed-off-by: Ritikaa96 <ritika@india.nec.com>

Kubernetes-commit: 3848c8b07a4b09d6fe9c8ea88b4229c6f637baf4
2024-04-08 15:02:36 +05:30
Matthias Riegler 90963a2f06 feat: make user-defined plugins discoverable with e.g. kubectl help (#116752)
* feat: make user-defined plugins discoverable with e.g. kubectl help

Signed-off-by: Matthias Riegler <matthias.riegler@ankorstore.com>

* fix: make help text localizable & rename it

Signed-off-by: Matthias Riegler <matthias.riegler@ankorstore.com>

* chore: address CRs, cleanup

Signed-off-by: Matthias Riegler <matthias.riegler@ankorstore.com>

* fix: plugin execution

Signed-off-by: Matthias Riegler <matthias.riegler@ankorstore.com>

---------

Signed-off-by: Matthias Riegler <matthias.riegler@ankorstore.com>

Kubernetes-commit: d7b7a85fbc0b3831cbc6a750a47dfdcdf777d519
2023-09-06 18:12:52 +02: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ü d3f76f431e Enable plugin resolution as subcommand for selected builtin commands (#116293)
* Enable plugin resolution as subcommand for selected builtin commands

This PR adds external plugin resolution as subcommand for selected builtin
commands if subcommand does not exist as builtin.

In it's alpha stage, this will only be enabled for create command and
this feature is hidden behind `KUBECTL_ENABLE_CMD_SHADOW` environment variable.

* Rename parameter to exactMatch to better reflect

Kubernetes-commit: a901bb630b5a353898c1b35df582a7faeef160a0
2023-03-09 16:16:01 +03:00
inosato 8272d71ba6 Remove ioutil from kubectl
Signed-off-by: inosato <si17_21@yahoo.co.jp>

Kubernetes-commit: 774ab1349bfd553c97a99b992e9f38659f541c84
2022-07-30 22:31:16 +09:00
Marc Khouzam d2df859d92 Add support for shell completion for plugins
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
2021-09-15 21:44:07 -04:00
Kazuki Suda 9c405e27d0 Add completion support for kubectl plugins
This commit allows us to get shell completion for kubectl plugins.

For example, with the use of a plugin named 'kubectl-krew', completing
   kubectl k<tab>
will include 'krew' in the list of possible completions.

Because the shell completion scripts are generated by Cobra, this commit
took the approach of registering every plugin as a Cobra command.  This
makes Cobra aware of each plugin command when generating completions.

For efficiency, searching for plugins and registering them as Cobra
commands is only done when needed, which is when calling the
'kubectl completion' command in the case of bash, as it includes all
commands and subcommands directly in the bash generated script.

For the other shells, this will need to be done for the
'kubectl __complete' command, in a follow-up command.

Co-authored-by: Marc Khouzam <marc.khouzam@montreal.ca>
Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>

Kubernetes-commit: 3db3ff53cdf4b106365c5de9194153fc371868a7
2019-04-14 14:40:53 +09:00
Andrea Hoffer d6145c119b Adding an example for kubectl plugin list
Kubernetes-commit: f5612f100ef6a61dcc29ca783571e2b3c171abf1
2021-11-22 13:21:21 -05:00
navist2020 2128ec58c8 remove Factory that not used
Kubernetes-commit: 0a83041d4d3698d36ade2a310184248c61eec64f
2021-05-17 16:56:12 +08:00
Andrea Hoffer 09ed00ef49 Minor adjustments to descriptions and example text
Kubernetes-commit: 6b736f348483bb6b20d4633319305960f4d9e4c1
2021-07-06 15:05:26 -04:00
Heng WU 58dd520868 Update plugin.go
Kubernetes-commit: 3c1c53c06c7b95283a84b28d3566e74c201e0e21
2021-02-14 11:10:20 +08:00
Karl 'NaN' Wikström 38408eaa8c cleanup: use i18n.T on all command descriptions
cleanup: use i18n.T only on string literals

cleanup: sort imports

Add i18n dependency for wait.go

Remove translation on envResource

cleanup: translate string instead of variable

cleanup: sort imports

cleanup: translate string literal only

Kubernetes-commit: cc8428566ea7160c5b20410a1bee53ca7ddb998e
2020-10-09 13:16:13 +02:00
Cornelius Weig 8560c536e9 Link to krew's new project site
Kubernetes-commit: 152ee3b57a207abb1279f406b7832abb365e779f
2020-03-01 21:56:56 +01:00
Cornelius Weig 701d4a19e6 Use canonical URL for the krew project
Kubernetes-commit: 5a9a28f8ebdee91606afb2ec60757a4b6ed6ca1b
2020-02-26 23:05:28 +01:00
Cornelius Weig e54c7dba6a Add documentation around plugins
Documentation is added in several areas:
1. `kubectl plugin` now prints a note that plugins are best discovered
   with krew.dev and how to install it.
2. The kubectl book now has a new section about plugins, featuring
   - a very brief introduction to the kubectl plugin mechanism
   - a section about krew

Kubernetes-commit: ed0e0350854e34bad65de4db44c0f661a5851870
2020-02-26 14:50:50 +01:00
Brian Pursley 1777c19079 Fixed code formatting issues discovered by verify-gofmt
Kubernetes-commit: 2d21f16c38e704eaaa42d7d583ddd103c16d0d6b
2020-02-04 10:16:06 -05:00
Brian Pursley e9f1eb93f4 Fixed problem in unit test where error expected/actual comparison was not being performed
Kubernetes-commit: 97185e97529ef7c006f26bb3190805ad28f15ffe
2020-02-03 12:17:51 -05:00
Brian Pursley b69c2a4389 Removed unneeded newline (moved to end of directory not found message)
Kubernetes-commit: 48ee18b516b267ba062a1dd00a21e7ae10ecd805
2020-01-28 20:51:24 -05:00
Brian Pursley 346cf3d4f4 Ignore empty or blank string in path when listing plugins
Kubernetes-commit: f60c0af97710a5dca6f55f3c4a1480412ad50ec8
2020-01-28 17:04:31 -05:00
ritho b0cd1c2290 Do some Kubectl optimizations suggested by the golangci linter
The tool golangci-lint gives a bunch of warnings. This PR solves the easier/less controversial ones, so the code is simpler and a little bit more optimal, since it removes some if conditions.

Kubernetes-commit: cd2adbe760641f844d84d411f9adcf17fb6982ff
2019-06-04 01:25:43 -05:00
Sean Sullivan c6063dd846 Move pkg/kubectl/cmd/{command} to staging
Kubernetes-commit: 0e0ea523392f1121f61f99ac30a9bc2043eaed90
2019-08-01 11:01:40 -07:00