kubernetes-sigs / krew

📦 Find and install kubectl plugins
https://krew.sigs.k8s.io
Apache License 2.0
6.41k stars 369 forks source link

Shipping "kubectl create something" plugin is impossible #865

Open sttts opened 1 month ago

sttts commented 1 month ago

Wile looking into shipping a kubectl create something plugin via krew I noticed that the - => _ rewriting in https://github.com/kubernetes-sigs/krew/blob/48b3ea15a8f640bbfca550782a9ccf9051f13731/internal/installation/install.go#L242 makes this impossible right now.

Background: kubectl allows these create plugins (and only those) since https://github.com/kubernetes/kubernetes/pull/124123.

Basically we have this situation:

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

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

ahmetb commented 1 month ago

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