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

[Proposal] Have kn look up plugins on $PATH by default #1399

Closed
psschwei opened this issue Jul 23, 2021 · 8 comments · Fixed by #1412
Closed

[Proposal] Have kn look up plugins on $PATH by default #1399

psschwei opened this issue Jul 23, 2021 · 8 comments · Fixed by #1412
Assignees
Labels
kind/feature New feature or request kind/proposal Issues or PRs related to proposals.

Comments

@psschwei
Copy link
Contributor

Feature request

The kn client by default will look in $PATH for plugins. This would mirror the performance of kubectl and provide an easier way for users to install plugins using tools like brew.

Use case

This arose out of discussions about the quickstart plugin we're building. The goal of that plugin was to provide a streamlined experience for new users to get up and running on Knative by running something like:

brew install knative/client/kn
brew install knative-sandbox/kn-plugins/quickstart
kn quickstart kind

However, the last command does not work, as kn by default does not look up plugins from $PATH (which is where brew installs them).

See also disucssion in Slack and in the homebrew-kn-plugins repo.

/kind proposal
cc @omerbensaadon @csantanapr

@psschwei psschwei added the kind/feature New feature or request label Jul 23, 2021
@knative-prow-robot knative-prow-robot added the kind/proposal Issues or PRs related to proposals. label Jul 23, 2021
@maximilien
Copy link
Contributor

maximilien commented Jul 23, 2021

In principle I am not against this. As discussed in the QuickStart PR I have added the link to show that this is how plugins worked initially for kn.

However, as I recall, there was lots of discussions (which you can revive and re-read, if you want, by searching plugin related issues and PRs) that resulted in where we are. So essentially this rehashes past decisions.

Since I've always been for look up in PATH as default --- simply because I wanted kn to behave like kubectl and I am pretty sure have mentioned this in these issues and PRs, I will recuse myself from this discussion until needed.

Good thing in all of this is that the implementation to make PATH lookup default is a one liner + any test changes :) so hopefully decision is as quick. Cheers 🍻

@duglin
Copy link
Contributor

duglin commented Jul 24, 2021

+1 to this - I never liked that we didn't look in the PATH to being with :-)

@csantanapr
Copy link
Member

+1 on looking in PATH like kubectl and oc plugins

@lance
Copy link
Member

lance commented Jul 27, 2021

I like the idea of looking in $PATH for func because func can also be used standalone - i.e. not as a plugin - which is how I usually use it. If it's in my path then func create and kn func create are the same.

@rhuss
Copy link
Contributor

rhuss commented Jul 28, 2021

it's in my path then func create and kn func create are the same.

That's not true, it's still need to be called kn-func. So kn-func and kn func would be equivalent.

@rhuss
Copy link
Contributor

rhuss commented Jul 28, 2021

I think we can allow a PATH lookup if we still can keep lookup from ~/.config/kn/plugins.

My proposal would be:

  • Lookup plugins from both, the path and ~/.config/kn/plugins.
  • Same named plugin in ~/.config/kn/plugins take precedence over plugins found on the PATH.

This would also allow for system-wide plugins as installed by brew in /usr/local/bin, but allow individual users to override plugins in their ~/.config/kn/plugins directory.

Also, for people that currently collect their plugins in ~/.config/kn/plugins nothing would change. It's just as if you would add this directory to the front of your $PATH. I would then even remove the config variable lookupConfigInPath as this would be always true then.

Actually, that was also my suggestion anyway when I proposed it at that time as a compromise for a discussion that was more heated then need to be :) --> #269 (comment)

@rhuss
Copy link
Contributor

rhuss commented Aug 3, 2021

Decided in the WG Call: Let's go with this approach as this is the kubectl behaviour plus some own extension that could be used (or not) and allows user-specific plugins.

@psschwei
Copy link
Contributor Author

psschwei commented Aug 3, 2021

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request kind/proposal Issues or PRs related to proposals.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants