Open sfxworks opened 1 year ago
Upon further inspection
total 0
drwxr-xr-x 2 sam sam 125 May 24 21:13 .
drwxr-xr-x 6 sam sam 59 May 13 22:53 ..
lrwxrwxrwx 1 sam sam 49 May 13 22:54 kubectl-change_ns -> /home/sam/.krew/store/change-ns/v1.0.0/kubectl-ns
lrwxrwxrwx 1 sam sam 38 May 13 22:53 kubectl-krew -> /home/sam/.krew/store/krew/v0.4.3/krew
lrwxrwxrwx 1 sam sam 51 May 24 21:13 kubectl-kubectl_ai -> /home/sam/.krew/store/kubectl-ai/v0.0.10/kubectl-ai
lrwxrwxrwx 1 sam sam 59 May 13 22:57 kubectl-rook_ceph -> /home/sam/.krew/store/rook-ceph/v0.4.0/kubectl-rook-ceph.sh
lrwxrwxrwx 1 sam sam 52 May 13 22:56 kubectl-who_can -> /home/sam/.krew/store/who-can/v0.4.0/kubectl-who-can
Looks like to fix this
I could make a PR later after investigating your build process
@sfxworks thanks for the report! i can repro this behavior.
It seems like krew is trying to be clever by adding a kubectl-
in front of the executable and then replacing -
with _
. Looks like normally this can be solved with specifying files
to rename the binary.
https://krew.sigs.k8s.io/docs/developer-guide/plugin-manifest/
However, in this case, we are autogenerating the krew manifest using goreleaser (https://github.com/sozercan/kubectl-ai/blob/main/.goreleaser.yaml) Unfortunately, I don't see a way in goreleaser to rename the binaries: https://goreleaser.com/customization/krew/
If we rename the binary to be just ai
, it will break the other installation methods, like brew or archives.
Quickest workaround for this seems to be mv $HOME/.krew/bin/kubectl-kubectl_ai $HOME/.krew/bin/kubectl-ai
(guessing this will need to be done after every upgrade ☹️)
Another option is to add a new build for ai
in goreleaser only to be used in krews
.
Let me know if you find any other solutions or interested in contributing one of the workarounds.
If you're intent on using goreleaser, you may want to raise an issue in their PR requesting this feature. It looks like homebrew offers a post install scrip though that could conduct the rename if needed. A third option could be to switch to some prewritten github actions for homebrew and krew that already offer the features you'd need here. Krew is a popular plugin manager for kubectl, so I'd at least note the current post-install step required in the readme. I just adjusted the symlink myself (Mine was a symlink rather than the binary).
Installs just fine
Though I get an error when calling it
But my other plugins such as the rook-ceph one work fine