k9s
k9s copied to clipboard
if the name of two CRD have same prefix,it can not distinguish CR

Describe the bug
In my cluster,there are two CRD,whose name look alike.Their name are both start with 'licenses'.
In fact,they have different CR now
However,in k9s,when I try to list CR for those two CRD separately,they all display the same CR
Let me guess,it is judged by only the first word 'licenses',so it can not distinguish the difference.
Versions :
- OS: [Windows 10]
- K9s: [0.25.18]
- K8s: [1.20.0]
I noticed this as well and as a quick hack, I edited the crds singular and/or plural name at which point k9s was able to find it (it's possible that has some other implications, but I haven't noticed any issues yet). I do think it would be nice search for the fully qualified name of the crd within k9s
I noticed this as well and as a quick hack, I edited the crds singular and/or plural name at which point k9s was able to find it (it's possible that has some other implications, but I haven't noticed any issues yet). I do think it would be nice search for the fully qualified name of the crd within k9s
I have tried the workaround you said, and it works. Thanks a lot.
When I type in kubectl get licenses -A
in bash, it lists CR that belongs to the first CRD. Maybe k9s
straightly inherit some kind of mechanism from kubernetes, but I am a totally rookie for kubernetes
and Golang
.-_-
A workaround is to use the syntax used by output of kubectl api-resources
i.e. group/version/name e.g. pkg.crossplane.io/v1alpha1/controllerconfigs
$ kubectl api-resources
NAME SHORTNAMES APIVERSION NAMESPACED KIND
[...]
controllerconfigs pkg.crossplane.io/v1alpha1 false ControllerConfig
[...]
controllerconfigs machineconfiguration.openshift.io/v1 false ControllerConfig
@gberche-orange Perfect, much better suggestion :) IMO this could probably be closed so long as there is a way to distinguish the custom resources from one another without needing to modify them.
@gberche-orange Thank you!!
Right, as the crd command space is getting a bit crowded conflicts are unavoidable. Don't forget tho even in this case, k9s has your back! and it's even doc'ed out custom alias Surprised?
I haven't tested this in a while but in Guillaume's case, one could define a couple of custom aliases ie ccc
and cco
for crossplane vs openshift controllerconfigs. It's well known that I suck at typing thus custom aliases are handy when there are no shortnames but also when there are conflicts and one must specified the full gvr. Who has time for that??
Another tip from your uncle Larry ;)
Yet another awesome feature of k9s :) will definitely have to look into using that!
Haha, got it. It's a good method, just spend a moment to remember the 'APIVERSION' and 'NAME' for each one. @j2udevelopment @derailed @gberche-orange Thank you!
Someone who has same confusion, try to find the description of CRD and concat 'spec.group','spec.versions.name' and 'spec.names.plural'. K9S can distinguish it.
And you could also find the combination by command kubectl api-resources
, as @gberche-orange mentioned in this thread.
A nice evolution for k9s would be to use the ${group}/${version}/${name} syntax in the crds view when pressing Return
key goes from a crd to list of related cr.
As a workaround, I'll trying crafting a k9s plugin which displays the syntax to use within the crd view. Can't go much further since AFAIK plugins don't yet allow to browse within k9s screens but only launch external commands.
Seems related: if I go to the "crds" screen (:crds
), I can press enter on a CRD to list all its resources. However that doesn't work if there is another CRD with the same short name.