k3s/pkg/kubectl
Kubernetes Submit Queue d4ece0abc3 Merge pull request #37499 from fabianofranz/kubectl_plugins
Automatic merge from submit-queue

kubectl binary plugins

**What this PR does / why we need it**:

Introduces the ability to extend `kubectl` by adding third-party plugins that will be exposed through `kubectl`.

Plugins are executable commands written in any language. To be included as a plugin, a binary or script file has to

1. be located under one of the supported plugin path locations:
1.1 `~/.kubectl/plugins` dir
1.2. one or more directory set in the `KUBECTL_PLUGINS_PATH` env var
1.3. the `kubectl/plugins` dir under one or more directory set in the `XDG_DATA_DIRS` env var, which defaults to `/usr/local/share:/usr/share`
2. in any of the plugin path above, have a subfolder with the plugin file(s)
3. in the subfolder, contain at least a `plugin.yaml` file that describes the plugin

Example:

```
$ cat ~/.kube/plugins/myplugin/plugin.yaml
name: "myplugin"
shortDesc: "My plugin's short description"
command: "echo Hello plugins!"

$ kubectl myplugin
Hello plugins!
```

~~In case the plugin declares `tunnel: true`, the plugin engine will pass the `KUBECTL_PLUGIN_API_HOST` env var when calling the plugin binary. Plugins can then access the Kube REST API in "http://$KUBECTL_PLUGIN_API_HOST/api" using the same context currently in use by `kubectl`.~~

Test plugins are provided in `pkg/kubectl/plugins/examples`. Just copy (or symlink) the files to `~/.kube/plugins` to test.

**Which issue this PR fixes**:

Related to the discussions in the proposal document: https://github.com/kubernetes/kubernetes/pull/30086 and https://github.com/kubernetes/community/pull/122.

**Release note**:
```release-note
Introduces the ability to extend kubectl by adding third-party plugins. Developer preview, please refer to the documentation for instructions about how to use it.
```
2017-04-28 12:23:59 -07:00
..
cmd Merge pull request #37499 from fabianofranz/kubectl_plugins 2017-04-28 12:23:59 -07:00
metricsutil autogenerated 2017-04-14 10:40:57 -07:00
plugins Basic support for kubectl plugins 2017-04-28 01:34:07 -03:00
resource refactor edit to remove cobra dependency and also make it reusable 2017-04-18 20:44:25 +08:00
testing autogenerated 2017-04-14 10:40:57 -07:00
BUILD Basic support for kubectl plugins 2017-04-28 01:34:07 -03:00
OWNERS
apply.go
autoscale.go
bash_comp_utils.go
cluster.go
cluster_test.go
clusterrolebinding.go Merge pull request #43509 from xilabao/remove-duplicate-in-create-rolebinding 2017-03-29 16:05:23 -07:00
configmap.go configmap.go: add one initialization symbol 2017-04-24 21:26:32 +08:00
configmap_test.go create configmap from-env-file 2017-03-08 07:58:01 -08:00
deployment.go Introduce new generator for apps/v1beta1 deployments 2017-03-10 12:08:01 +01:00
deployment_test.go Introduce new generator for apps/v1beta1 deployments 2017-03-10 12:08:01 +01:00
doc.go
env_file.go create configmap from-env-file 2017-03-08 07:58:01 -08:00
explain.go
generate.go
generate_test.go
history.go Clean up pre-ControllerRef compatibility logic 2017-04-07 14:09:23 +08:00
interfaces.go
kubectl.go
kubectl_test.go
namespace.go
namespace_test.go
pdb.go
proxy_server.go
proxy_server_test.go
quota.go
quota_test.go
resource_filter.go
rolebinding.go Merge pull request #43509 from xilabao/remove-duplicate-in-create-rolebinding 2017-03-29 16:05:23 -07:00
rolebinding_test.go Supplement unit tests to `kubectl create rolebinding` command. 2017-03-29 16:36:22 +08:00
rollback.go Clean up pre-ControllerRef compatibility logic 2017-04-07 14:09:23 +08:00
rolling_updater.go move pkg/api/v1/ref.go and pkg/api/v1/resource.go to subpackages. move some functions in resource.go to pkg/api/v1/node and pkg/api/v1/pod 2017-04-17 11:38:11 -07:00
rolling_updater_test.go move helpers.go to helper 2017-04-11 15:49:11 -07:00
rollout_status.go Revert respecting maxUnavailable for DaemonSets 2017-04-22 17:18:09 +02:00
rollout_status_test.go Revert respecting maxUnavailable for DaemonSets 2017-04-22 17:18:09 +02:00
run.go Introduce new generator for apps/v1beta1 deployments 2017-03-10 12:08:01 +01:00
run_test.go Introduce new generator for apps/v1beta1 deployments 2017-03-10 12:08:01 +01:00
scale.go
scale_test.go
secret.go secret.go: add initial symbol and format err 2017-04-25 10:47:50 +08:00
secret_for_docker_registry.go
secret_for_docker_registry_test.go
secret_for_tls.go
secret_for_tls_test.go
secret_test.go create secret from-env-file 2017-03-08 07:58:01 -08:00
service.go
service_basic.go
service_basic_test.go
service_test.go
serviceaccount.go
serviceaccount_test.go
sorting_printer.go
sorting_printer_test.go make unstructured items correspond to other items for storage 2017-04-11 08:44:16 -04:00
stop.go Clean up pre-ControllerRef compatibility logic 2017-04-07 14:09:23 +08:00
stop_test.go Clean up pre-ControllerRef compatibility logic 2017-04-07 14:09:23 +08:00
versioned_client.go