predictable resolution for gitrepository gvk when v1 and v1beta2 exist#3980
Merged
predictable resolution for gitrepository gvk when v1 and v1beta2 exist#3980
Conversation
31abffa to
c961c96
Compare
jpellizzari
approved these changes
Sep 1, 2023
Contributor
jpellizzari
left a comment
There was a problem hiding this comment.
A bit confused on the logic in primarykinds.go, but that is not the concern of the PR, so 👍
| // Beta versions are more stable than alpha versions but might still contain bugs. | ||
| // They are given a higher weight than alpha versions. | ||
| betaWeight = 500 | ||
| betaWeight = 50 |
Contributor
There was a problem hiding this comment.
Just for clarification: we determine which kinds to use at runtime?
Contributor
Author
Contributor
There was a problem hiding this comment.
Seems like a bit of an anti-pattern...
chanwit
approved these changes
Sep 5, 2023
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3626
What changed?
Adjusted weights to avoid the ranking function computes v1 and v1beta2 with the same value.
Why was this change made?
We noticed that sometimes gvk resolution for gitrepositories was returning
v1beta2instead ofv1which was expected. The reason was that bothv1andv1beta2level had the same ranking value.Therefore v1 or v1beta2 was returned depending on which one was first introduced in primaryKinds. Given
AllKnownTypeswas randomly returning either of them, we got to that unpredictable behavior.How was this change implemented?
Adjusted weights to avoid the ranking function computes v1 and v1beta2 with the same value.
How did you validate the change?
Added test case for supporting the specific case and for the gitRepository from primaryKinds.
Also tested e2e