-
Notifications
You must be signed in to change notification settings - Fork 157
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
predictable resolution for gitrepository gvk when v1 and v1beta2 exist #3980
Conversation
31abffa
to
c961c96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit confused on the logic in primarykinds.go
, but that is not the concern of the PR, so 👍
@@ -25,7 +25,7 @@ const ( | |||
// It's multiplied with the digit following the "beta" suffix. | |||
// 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for clarification: we determine which kinds to use at runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a bit of an anti-pattern...
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
v1beta2
instead ofv1
which was expected. The reason was that bothv1
andv1beta2
level had the same ranking value.Therefore v1 or v1beta2 was returned depending on which one was first introduced in primaryKinds. Given
AllKnownTypes
was 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