ApiGroup::recommended_kind
returns None
while I expected Some(_)
#1289
Labels
docs
unclear documentation
Current and expected behavior
I would expect for
ApiGroup::recommended_kind
to return a kind when one exists. And only return None when no viable kind exist.Imagine 2 CRD deployed
KindA
andKindB
. both in the same groupexample.com
KindA
has versionsv1
andv2
.KindB
only supportsv1
.Now running
recommended_kind
forKindB
will result in the following.The code of https://github.com/kube-rs/kube/blob/0.85.0/kube-client/src/discovery/apigroup.rs#L301 will first detect the preferable version, which is
v2
and now it does not find any kind supporting this.So the coding asserts that all Kinds in a Group support the same version.
I would either expect a change in that behavior and fall back to v1. or at least add a comment to the function so that its clear that it might return None, even if there working versions available, when another kind in a similar group has a newer version. And link to the
resources_by_stability
function.Possible solution
I am not 100% sure if this is a documentation bug or a actual behavior bug.
In case of a documentation bug. Add the documentation to make people aware of this constellation.
Otherwise, we need to check other versions, if the loop finished and the return inside wasnt hit.
Additional context
No response
Environment
Configuration and features
Affected crates
No response
Would you like to work on fixing this bug?
maybe
The text was updated successfully, but these errors were encountered: