You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Items marked with (R) are required *prior to targeting to a milestone / release*.
49
48
50
-
-[] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
49
+
-[x] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
51
50
-[ ] (R) KEP approvers have approved the KEP status as `implementable`
52
-
-[] (R) Design details are appropriately documented
51
+
-[x] (R) Design details are appropriately documented
53
52
-[ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
54
53
-[ ] e2e Tests for all Beta API Operations (endpoints)
55
54
-[ ] (R) Ensure GA e2e tests meet requirements for [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
56
55
-[ ] (R) Minimum Two Week Window for GA e2e tests to prove flake free
57
-
-[] (R) Graduation criteria is in place
56
+
-[x] (R) Graduation criteria is in place
58
57
-[ ] (R) [all GA Endpoints](https://github.com/kubernetes/community/pull/1806) must be hit by [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
59
58
-[ ] (R) Production readiness review completed
60
59
-[ ] (R) Production readiness review approved
@@ -70,7 +69,7 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
70
69
71
70
## Summary
72
71
73
-
This KEP enables external plugins being used as subcommands of built-in `create` command via new `--use-plugin` flag.
72
+
This KEP allows external plugins to be used as subcommands of built-in commands when the subcommand does not exist.
74
73
75
74
## Motivation
76
75
@@ -84,44 +83,36 @@ This KEP proposes a viable alternative to users via plugins instead of creating
84
83
85
84
### Goals
86
85
87
-
* Enable external plugin usage for `kubectl create` command
86
+
* Enable external plugin usage for `kubectl` built-in commands as subcommands, if subcommands does not exist.
88
87
89
88
### Non-Goals
90
89
91
90
* Implement a plugin
92
91
93
92
## Proposal
94
93
95
-
This KEP introduces a new boolean flag, namely `--use-plugin`. Without this flag, plugin mechanism will work
96
-
exactly the way it already works. On the other hand, if the user passes this flag;
94
+
When user executes a subcommand of a built-in command, instead returning an "unknown command" error, `kubectl`will search this subcommand
95
+
in external plugins with the name structure similar to current plugin search mechanism(e.g. `kubectl-create-foo`).
97
96
98
97
```sh
99
-
$ kubectl foo --use-plugin
100
-
(running kubectl-foo plugin without passing --use-plugin flag)
101
-
102
-
$ kubectl set env --use-plugin
103
-
("Error: set command is not allowed for shadowing by plugins")
104
-
105
-
$ kubectl create job --use-plugin
106
-
(running kubectl-create-job plugin without passing --use-plugin flag. If the plugin is not found, failing)
98
+
$ kubectl create foo
99
+
(running kubectl-create-foo plugin)
107
100
```
108
101
109
-
Being said that `--use-plugin` will be used to force plugin execution and do this only for allowed built-in commands. Currently,
110
-
only `create` command will be supported and this list can be extended in future considerations.
102
+
If `kubectl` finds a match for the subcommand, it will execute this external plugin how it already does
103
+
for external plugins currently.
111
104
112
-
Because of starting as alpha and this is an explicitly opted-in feature, `--use-plugin` flag is only visible and usable after setting;
105
+
Because of starting as alpha and this is an explicitly opted-in feature, shadowing functionality will be hidden behind the environment variable
106
+
and will only be used after exporting;
113
107
```sh
114
108
export KUBECTL_ENABLE_ALPHA_CMD_SHADOW=true
115
109
```
116
110
117
111
### Notes/Constraints/Caveats
118
112
119
-
In terms of built-in commands, there is not any constraint. Because if user passes the flag, command will be run as plugin regardless
120
-
of existed or not. In terms of plugins, this proposal has a notable constraint that `--use-plugin` flag will be removed while
121
-
executing plugin. That means that if plugin internally also supports `--use-plugin` flag, flag will not be passed. The reason of
122
-
this constraint is that there is no differentiation between user passes `--use-plugin` flag to force plugin usage or actually tries
123
-
to pass `--use-plugin` flag to plugin. This can simply be overcome by plugin owners will use different flag naming rather than `--use-plugin`
124
-
which is supposed to be special flag in the manner of this proposal.
113
+
This KEP in alpha and beta stage will only support shadowing for `kubectl create` to get feedback for other
114
+
built-in commands as well. Currently, we know that there are requests for `kubectl create` command but we need to find out
115
+
which other built-in commands will also be requested for this shadowing.
0 commit comments