🐛 Restmapper: Respect preferred version#3151
🐛 Restmapper: Respect preferred version#3151k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
Conversation
pkg/client/apiutil/restmapper.go
Outdated
|
|
||
| if !found { | ||
| groupResources.Group.Versions = append(groupResources.Group.Versions, metav1.GroupVersionForDiscovery{ | ||
| doc := metav1.GroupVersionForDiscovery{ |
There was a problem hiding this comment.
| doc := metav1.GroupVersionForDiscovery{ | |
| gv := metav1.GroupVersionForDiscovery{ |
Short for GroupVersion. Just a suggestion. A short variable name makes sense here since the scope of the variable is short. Curious to know what doc/document has to do with this. 🤔
stefanprodan
left a comment
There was a problem hiding this comment.
LGTM
I've tested this fix in Flux and the issue with preferred version is gone. Thanks @alvaroaleman 🥇
|
@stefanprodan: changing LGTM is restricted to collaborators DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, stefanprodan The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| Kind: "Driver", | ||
| }) | ||
| g.Expect(err).NotTo(gmg.HaveOccurred()) | ||
| g.Expect(mapping.GroupVersionKind.Version).To(gmg.Equal("v2")) |
There was a problem hiding this comment.
Q: Just curious. What makes v2 the preferred version in this test?
Does the apiserver have some logic that prefers v2 over v1?
(maybe worth adding a godoc)
erikgb
left a comment
There was a problem hiding this comment.
Just a minor nit question/comment from me. Otherwise LGTM! Thanks a lot for looking into this!
pkg/client/apiutil/restmapper.go
Outdated
|
|
||
| if !found { | ||
| groupResources.Group.Versions = append(groupResources.Group.Versions, metav1.GroupVersionForDiscovery{ | ||
| doc := metav1.GroupVersionForDiscovery{ |
There was a problem hiding this comment.
| doc := metav1.GroupVersionForDiscovery{ | |
| gv := metav1.GroupVersionForDiscovery{ |
Short for GroupVersion. Just a suggestion. A short variable name makes sense here since the scope of the variable is short. Curious to know what doc/document has to do with this. 🤔
When requesting a resource without version through methods such as `RESTMapping`, the mapper would previously return a random version rather than the preferred one, this change fixes that.
2dad16f to
d724f7f
Compare
|
LGTM label has been added. DetailsGit tree hash: ea6e2e638195caece1d1772f211f8ffc66713be6 |
|
@alvaroaleman: new pull request created: #3159 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/lgtm |
When requesting a resource without version through methods such as
RESTMapping, the mapper would previously return a random version rather than the preferred one, this change fixes that.Fixes #3133
/cherrypick release-0.20