Closed armand-AbsolutSensing closed 2 weeks ago
Thanks for raising this! Yup that's a bug that totally needs fixing. It looks like the specific section of code is here.
I think we need to look up all resources for all versions and return them all from async_api_resources()
.
The implication of doing this is that in places that use the [async_]api_resources()
methods there will be duplicates across many versions so we need to implement sorting correctly.
https://github.com/kr8s-org/kr8s/blob/721dc09cca5f9d202c3ddc9675d9c1e40ab5a75d/kr8s/_api.py#L293
For example we would need to make sure that await api.lookup_kind("gitrepositories")
returns the v1
version.
Which project are you reporting a bug for?
kr8s
What happened?
I notice that using kr8s to list some custom crds (helmrepositories and gitrepositories from flux project). I can found gitrepositories but not helmrepositories, event if it's working with kubectl.
After investigation it seems to be caused by them being both from the same group (source.toolkit.fluxcd.io) but gitrepositories is available in version v1(latest), v1beta2(deprecated), v1beta1(deprecated) and helmrepositories only in v1beta2(latest), v1beta1(deprecated) . When listing resources, the function async_api_resources will look for each group associated with theirs latest version (here v1) and get all the associated resource, ignoring the other version, so cannot found resource helmrepositories.
Anything else?
No response