Closed morozov closed 2 years ago
@morozov that could work. Want to try to put together a PR to utilize api-resources?
It turns out that kubectl api-resources
is much (10+ times) slower than kubectl get crd
since it does one API call per resource (46 in total in my case) instead of just one. I ended up hard-coding the missing types in the completion script for now. Not sure what else alternatives there are.
@morozov maybe we could add an env var that allows one to specify a comma separated list of crds to include?
I'm no longer affected by this issue since I now have the permissions to run kubectl get crd
. I was implemented as documented in the description.
If I were to implement a fix for this issue, an environment variable would be the best approach. But it looks like nobody else is affected by this issue.
As a non-cluster-admin, I have to disable custom resource name completion via
set FISH_KUBECTL_COMPLETION_COMPLETE_CRDS 0
. Otherwise, completion doesn't work due to the internal:As far as I understand the API, granting mere humans access to CRDs requires and additional cluster role like:
On the other hand, as a non-cluster-admin, I have access to
kubectl api-resources
whose output contains the out-of-the-box and custom resources:Would it make sense to reimplement
__fish_kubectl_actually_get_crds
viakubectl api-resources
instead ofkubectl get crd
?