k3s/pkg/kubectl/cmd
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
..
auth remove warning infomation when use '*' 2017-04-18 16:10:21 +08:00
config Merge pull request #43517 from zjj2wry/007 2017-04-24 06:27:52 -07:00
rollout autogenerated 2017-04-14 10:40:57 -07:00
set autogenerated 2017-04-14 10:40:57 -07:00
templates Basic support for kubectl plugins 2017-04-28 01:34:07 -03:00
testdata/edit autogenerated 2017-04-14 10:40:57 -07:00
testing Basic support for kubectl plugins 2017-04-28 01:34:07 -03:00
util Basic support for kubectl plugins 2017-04-28 01:34:07 -03:00
BUILD Basic support for kubectl plugins 2017-04-28 01:34:07 -03:00
annotate.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
annotate_test.go kubectl/cmd: remove a bunch of unused parameters 2017-04-04 10:36:30 +01:00
apiversions.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
apply.go Merge pull request #41530 from bruceauyeung/k8s-branch-do-not-use-underscores-in-go-variable-names 2017-04-28 09:28:13 -07:00
apply_set_last_applied.go refactor edit to remove cobra dependency and also make it reusable 2017-04-18 20:44:25 +08:00
apply_test.go Merge pull request #41699 from liggitt/apply-output-result 2017-02-28 07:51:22 -08:00
apply_view_last_applied.go Merge pull request #44207 from shiywang/hotfix 2017-04-24 20:25:48 -07:00
attach.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
attach_test.go Decouple remotecommand client from term/kubelet dependencies 2017-04-13 15:56:40 +03:00
autoscale.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
certificates.go move category expansion out of restmapper 2017-03-27 13:54:05 -04:00
clusterinfo.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
clusterinfo_dump.go Merge pull request #44088 from xingzhou/kube-44069 2017-04-18 07:42:14 -07:00
clusterinfo_dump_test.go
cmd.go Merge pull request #37499 from fabianofranz/kubectl_plugins 2017-04-28 12:23:59 -07:00
cmd_test.go Fix error printing objects from kubectl get -w 2017-02-28 22:36:26 -05:00
completion.go Merge pull request #43297 from mvdan/kubectl-params 2017-04-13 04:07:21 -07:00
convert.go Merge pull request #43297 from mvdan/kubectl-params 2017-04-13 04:07:21 -07:00
cp.go Merge pull request #43297 from mvdan/kubectl-params 2017-04-13 04:07:21 -07:00
cp_test.go
create.go refactor edit to remove cobra dependency and also make it reusable 2017-04-18 20:44:25 +08:00
create_clusterrole.go support subresource when running kubectl create role 2017-04-24 10:05:47 +08:00
create_clusterrole_test.go Added `kubectl create clusterrole` command. 2017-02-22 10:30:41 +08:00
create_clusterrolebinding.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
create_configmap.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
create_configmap_test.go client/restclient/fake move to client-go 2017-01-25 08:29:48 -05:00
create_deployment.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
create_deployment_test.go Introduce new generator for apps/v1beta1 deployments 2017-03-10 12:08:01 +01:00
create_namespace.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
create_namespace_test.go client/restclient/fake move to client-go 2017-01-25 08:29:48 -05:00
create_pdb.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
create_quota.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
create_quota_test.go client/restclient/fake move to client-go 2017-01-25 08:29:48 -05:00
create_role.go remove resourcename validation in create role 2017-04-25 09:22:02 +08:00
create_role_test.go remove resourcename validation in create role 2017-04-25 09:22:02 +08:00
create_rolebinding.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
create_rolebinding_test.go Supplement unit tests to `kubectl create rolebinding` command. 2017-03-29 16:36:22 +08:00
create_secret.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
create_secret_test.go client/restclient/fake move to client-go 2017-01-25 08:29:48 -05:00
create_service.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
create_service_test.go client/restclient/fake move to client-go 2017-01-25 08:29:48 -05:00
create_serviceaccount.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
create_serviceaccount_test.go client/restclient/fake move to client-go 2017-01-25 08:29:48 -05:00
create_test.go Distinguish between client and unstructuredclient in fake factory 2017-01-26 19:59:16 -05:00
delete.go Merge pull request #44207 from shiywang/hotfix 2017-04-24 20:25:48 -07:00
delete_test.go Adding a unit test for verifying OrphanDependents in kubectl delete requests 2017-02-23 12:04:13 -08:00
describe.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
describe_test.go describe: use unstructured objects 2017-01-26 19:59:25 -05:00
drain.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
drain_test.go move ref.go to its own subpackage 2017-04-13 10:02:43 -07:00
edit.go refactor edit to remove cobra dependency and also make it reusable 2017-04-18 20:44:25 +08:00
edit_test.go make edit respect --save-config 2017-02-27 13:34:07 -08:00
exec.go Merge pull request #41543 from dshulyak/decouple_remotecommand 2017-04-13 19:52:05 -07:00
exec_test.go Decouple remotecommand client from term/kubelet dependencies 2017-04-13 15:56:40 +03:00
explain.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
expose.go Merge pull request #43297 from mvdan/kubectl-params 2017-04-13 04:07:21 -07:00
expose_test.go Refactor commands to use new factory method 2017-02-23 00:28:32 -05:00
get.go Merge pull request #41530 from bruceauyeung/k8s-branch-do-not-use-underscores-in-go-variable-names 2017-04-28 09:28:13 -07:00
get_test.go Reorganize the output of "kubectl get -o json" 2017-04-14 11:08:34 +08:00
help.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
label.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
label_test.go kubectl/cmd: remove a bunch of unused parameters 2017-04-04 10:36:30 +01:00
logs.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
logs_test.go client/restclient/fake move to client-go 2017-01-25 08:29:48 -05:00
options.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
patch.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
patch_test.go Fix 'not patched' kubectl error 2017-03-02 01:00:48 -05:00
plugin.go Plugins are loaded under the 'kubectl plugin' command 2017-04-28 01:34:07 -03:00
plugin_test.go Basic support for kubectl plugins 2017-04-28 01:34:07 -03:00
portforward.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
portforward_test.go kubectl/cmd: remove a bunch of unused parameters 2017-04-04 10:36:30 +01:00
proxy.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
replace.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
replace_test.go Distinguish between client and unstructuredclient in fake factory 2017-01-26 19:59:16 -05:00
rollingupdate.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
rollingupdate_test.go
run.go Merge pull request #41530 from bruceauyeung/k8s-branch-do-not-use-underscores-in-go-variable-names 2017-04-28 09:28:13 -07:00
run_test.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
scale.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
stop.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
taint.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00
taint_test.go Update tests. 2017-02-22 09:27:42 -05:00
top.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
top_node.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
top_node_test.go client/restclient/fake move to client-go 2017-01-25 08:29:48 -05:00
top_pod.go Extract a bunch more strings from kubectl 2017-04-06 20:12:50 -07:00
top_pod_test.go pkg/api/resource: move to apimachinery 2017-01-29 21:41:44 +01:00
top_test.go Update to use proxy subresource consistently 2017-02-13 22:05:00 -05:00
version.go Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn> 2017-04-25 15:07:01 +08:00