Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider adopting the kubectl "plugin" mechanism #110

Open
starpit opened this issue Dec 2, 2018 · 8 comments
Open

consider adopting the kubectl "plugin" mechanism #110

starpit opened this issue Dec 2, 2018 · 8 comments

Comments

@starpit
Copy link

starpit commented Dec 2, 2018

proposal: adopt kubectl's lightweight plugin mechanism for the openwhisk go cli. it's not even really a plugin mechanism, just a simple dispatcher. kubectl foo works if some executable kubectl-foo is on my PATH. kubectl is agnostic to the impl of kubectl-foo; i.e. it could be another go executable, a nodejs shebang, a bash script, etc.

getting this support into wsk should require only small changes, especially if we can leverage the platform's "which/type" support. i.e.: wsk foo, if not resolved by a built-in command or command subtree "foo" will delegate to the PATH resolver, which does a which foo. if this succeeds, it delegates the command line to an Exec of that resolved /path/to/foo.

kubectl also has a kubectl plugin list, which is a bit more time-intensive, but at the same time not latency sensitive: this one must scan PATH for matching wsk-xxxx executables.

@csantanapr
Copy link
Member

I think this is a good thing to add
So then I can get “wsk deploy” if I rename wskdeploy to wsk-deploy !
cc @mrutkows @mdeuser

@pritidesai
Copy link
Member

sounds like a great idea, @starpit what kind of changes are we anticipating? are you referring to something of this sort: https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/?

@mrutkows
Copy link
Contributor

mrutkows commented Dec 3, 2018

@starpit I am not opposed to this, but I still view this as a parallel path to what we want to do with making wskdeploy a plug-in of the CLI. See no reason that we cannot have a standalong CLI and a new resource/API for kubectl drawing from the same code eventually. @pritidesai https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/

@starpit
Copy link
Author

starpit commented Dec 3, 2018

You are inventing a plugin mechanism for wsk?

@mrutkows
Copy link
Contributor

mrutkows commented Dec 3, 2018

no, just advantaging existing Cobra framework

@starpit
Copy link
Author

starpit commented Dec 3, 2018

sounds like a great idea, @starpit what kind of changes are we anticipating? are you referring to something of this sort: https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/?

@pritidesai yes, this is what i was referring to. it's an incredibly lightweight approach, and one that allows plugin providers to target multiple CLIs without having to invest anything into the possibly disparate mechanisms (ibmcloud, cobra, etc.) offered by each CLI provider.

@pritidesai
Copy link
Member

thats great, have we experimented implementing this kind of setup outside of kubectl?

@starpit
Copy link
Author

starpit commented Dec 3, 2018

Not yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants