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

Shipping "kubectl create something" plugin is impossible #865

Open
sttts opened this issue Oct 9, 2024 · 1 comment
Open

Shipping "kubectl create something" plugin is impossible #865

sttts opened this issue Oct 9, 2024 · 1 comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@sttts
Copy link

sttts commented Oct 9, 2024

Wile looking into shipping a kubectl create something plugin via krew I noticed that the - => _ rewriting in

name = strings.ReplaceAll(name, "-", "_")
makes this impossible right now.

Background: kubectl allows these create plugins (and only those) since kubernetes/kubernetes#124123.

Basically we have this situation:

  • $ kubectl create-something maps to the binary kubectl-create_something
  • $ kubectl create something maps to the binary kubectl-create-something
  • krew does the mentioned rewriting, turning the binary of the create-something plugin into the kubectl-create_something binary on disk (even though the binary in the plugin tar is properly named.

How could we allow to ship a kubectl-create-something binary?

xref https://kubernetes.slack.com/archives/CTJNMDM24/p1728488438493869

@ahmetb
Copy link
Member

ahmetb commented Oct 10, 2024

TIL kubectl create [...] now allows plugins as of v1.30. I think we should have a spec field in the Plugin manifest to facilitate this. Open questions:

  1. Do we do this just for kubectl create? what if kubectl changes its mind to allow more builtin commands to support plugins, too?

  2. Do we only skip the first dash, or do we preserve all dashes

    For example should a Plugin with name: create-x-y-z be linked as kubectl-create-x_y_z or kubectl-create-x-y-z? The latter technically allows invocations like:

    • kubectl create x-y-z
    • kubectl create x y z
    • kubectl create x-y z
    • ...

    (Krew intentionally only supports the first form, i.e. plugin is registered only with its metadata.name, as-is).

/kind feature
/priority important-soon

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

No branches or pull requests

3 participants