* Promote plugin resolution to beta
* Not use plugin for kubectl create -f command execution
`kubectl create -f` is legitimate command execution and we shouldn't
search plugins if user invokes this.
* Add integration test for plugin resolution for create command
* Reintroduce feature flag to ability to disable it explicitly
Kubernetes-commit: 074a8b00840e85cc95fd83b1825b14ab21ad09c4
- test.args should be passed instead of the os.Args of the test framework
to prevent simple invocation of kubectl without args that could
manifest in false positive test runs
- plugin execution should have a different test path
- tests should invoke functioning kubectl commands instead of the mock
ones to ensure the correct subcommand is executed without a failure
Kubernetes-commit: 8b9cbe62025da49a31518870f2aea0ce9797d3ce
T.Setenv ensures that the environment is returned to its prior state
when the test ends. It also panics when called from a parallel test to
prevent racy test interdependencies.
Kubernetes-commit: 2181eea48435310d1b6e366ea8db2968c4941b93
* 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
Cobra adds the commands 'help', '__complete' and '__completeNoDesc'
inside rootCmd.Execute(), however, when kubectl decides if it should
lookup plugins, rootCmd.Execute() had not been called yet. Therefore,
the call to cmd.Find(cmdPathPieces) done by kubectl does not find the
commands added by Cobra. To fix this we must check for them explicitly.
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
Kubernetes-commit: e703b3d25377e763b117805b3d88fe7236f3ff76