kubernetes-sigs / krew

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

Proposal: kubectl krew list should not require a plugin index #838

Closed nonproto closed 8 months ago

nonproto commented 1 year ago

When developing, or installing plugins as an archive. Doing a kubectl krew list should show all installed plugins regardless of the default plugin index not existing, and shouldn't attempt to force you to use it.

chriskim06 commented 1 year ago

could you show the commands you ran that failed where you think they should succeed? i believe we allow krew to run without a default index (although krew-index ships as the default so it would need to be removed after the fact with kubectl krew index remove default)

nonproto commented 1 year ago

kubectl krew list comes back with krew local plugin index is not initialized (run kubectl krew update)

If you run this above then it works as designed but again requires the default plugin index. If you remove the default index with kubectl krew index remove default or by deleting the default folder in the krew install it comes back with krew local plugin index is not initialized (run kubectl krew update)

The only work around I've found so far is to git init in the empty default folder. Then kubectl krew list returns what is installed without setting the index.

ahmetb commented 1 year ago

I can repro it this way:

kubectl krew install tree whoami
kubectl krew index remove default --force
# no indexes exist at this point
kubectl krew list
# fails with error: krew local plugin index is not initialized (run "kubectl krew update")
# even though some plugins are installed

however if you just add a random index, it starts working again:

kubectl krew index add other https://github.com/ahmetb/krew-index.git
kubectl krew list
# (shows previously installed plugins)

I don't know why we have this pre-run check in list command but it might be handling an edge case we forgot about at this point.

The part I don't understand is why would someone try to use krew without any indexes. Can you clarify @CarlosEsco?

nonproto commented 1 year ago

@ahmetb We are in an air gapped cluster without git repo access internally or externally and have to side load plugins with the --manifest --archive options.

As for the pre-run check, i feel it should maybe warn, but continue at worst. Instead of completely failing, or requires an empty git repository.

chriskim06 commented 1 year ago

i feel like in that scenario you lose a lot of the benefits of krew since youre basically just manually installing binaries. i think you would only really have uninstall and list as the main usable functions and you can already do kubectl plugin list to somewhat make up for kubectl krew list (although it will only list what kubectl-* binaries are on your path).

ahmetb commented 1 year ago

Fwiw installing plugins with --manifest/--archive was only meant for development use (to plugin authors) and not quite for what you are doing. In your case, it might be wiser to just ship the binary and add to PATH instead of using Krew.

I agree though the check doesn’t do anything useful here and we can remove it.

nonproto commented 1 year ago

Agree with both your points, we just found it easier for users managing the cluster to be able to see what is installed for kubernetes and to use them as "native" extensions vs having the binaries themselves. We are also able to reuse the ansible plays pointing to the index for the non air gapped system.

k8s-triage-robot commented 10 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 9 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 8 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-ci-robot commented 8 months ago

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to [this](https://github.com/kubernetes-sigs/krew/issues/838#issuecomment-2023803024): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue with `/reopen` >- Mark this issue as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close not-planned > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.