-
-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discovery: Add ApiGroup::resources_by_stability
#1022
Conversation
d74e585
to
f07cefc
Compare
This is kind of by design. Even kubectl just picks the recommended version to show when getting resources, because there is only ever one stored version of each resource (other versions get converted). |
Oh, wait. This is not what you are saying, you are saying that two different api resources (in the same api group) uses different versioning within the group and thus you only see the ones from the latest version. 🤔 |
Yeah, I mean two different api resources (in the same api group). And I see the data has been sorted, right? So, the recommended resource will be preferred in the returned resources. |
Assume all resources are [(resource1, v1alpha1), (resource2, v1alpha1), (resource2, v1alpha2)]. |
Yeah, this sounds like the correct behaviour. Maybe at some point |
The annoying thing here is that Kubernetes effectively version their This PR is fine for catching cases where versioning differ within a group, but I think the sorting (in the example) is now broken as a result. |
I think we have no way to get the I made a test, there was a resource here are more details:
|
Hm, I don't think the stored version is relevant. A test on mv-crd will show that |
f07cefc
to
cb337b7
Compare
cb337b7
to
03e0dbe
Compare
@clux, I just improve the |
I like the idea of this, but I think it should be its own method. Currently However, would be open to having a method like |
Signed-off-by: chengqinglin <chengqinglin@icloud.com>
Signed-off-by: chengqinglin <chengqinglin@icloud.com>
b66e0d2
to
4bdfe02
Compare
@clux, I think the pr is ready now. |
ApiGroup::resources_by_stability
It looks great! Thanks a lot. I have only added some minor nits here and there. |
ApiGroup::resources_by_stability
ApiGroup::resources_by_stability
Signed-off-by: chengqinglin <chengqinglin@icloud.com>
690e5f2
to
e334d67
Compare
Signed-off-by: chengqinglin <chengqinglin@icloud.com>
The failed ci tests seem that the new added test |
Ah, it is also using |
Signed-off-by: chengqinglin <chengqinglin@icloud.com>
4f68397
to
2ce8885
Compare
An alternative approach to battling the slow discovery server for testing is to private construct an |
Yeah, to private construct an |
5a48c02
to
27ed70e
Compare
27ed70e
to
ce2bb6b
Compare
@clux. It's hard to solve the integration test problem. So I decide to take your advice to private construct an |
Appreciate it! Unit tests are easier for us to maintain in the long run as well :-) |
Motivation
Assume that there are custom resources: {resource1}.example.org/v1alpha1 and {resource2}.example.org/v1alpha2. Use the kubectl in the examples to exec
kubectl get resource1 -A
would result in resource1 not found. more details in pub fn versioned_resources, in the example only {resource2} returned.Solution
So, I add a fn
resources
to return all the resource in the api group.