-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix #3859: refinements to how a deserialization class is chosen #3899
Conversation
e3d3cc7
to
d1540fa
Compare
With the latest commit there's still a failure - we're trying to parse a Template, but it's class does not have the expected Group template.openshift.io annotation. I can either further relax the parsing, but it seems like that and any other annotation issue should get fixed. |
Just so this pr could be standalone, I updated the Template class group. Also updated the apiVersion for the pod test that was failing - and added to the migration guide that the api group name is now strict. |
Kudos, SonarCloud Quality Gate passed! |
## Deserialization Resolution | ||
|
||
The group on the object being deserialized is not required to match the prospective class - even for built-in types. This prevents the unintentional parsing of custom types without a registered class as a built-in type of the same name. This also means that you must ensure the apiVersion values are correct on the objects you are deserializing as they will no longer resolve to built-in type of the same name when there is a mistake. |
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.
Note to self, add this to 5.12.2 changelog if backproted
Description
This updates the search strategy used by the KubernetesDeserializer - to not use classes with conflicting apiGroups.
It goes further to not use classes with conflicting versions - but that leads to several test failures. That was a concern of @andreaTP when dealing with multiple versions - if they are custom resources which do not implement additionalProperties, then it could be a lossful conversion (if ignoring unmatched fields) or an exception when fields don't match.Sorry I wasn't thinking straight, the internal types are only going to be from what's in the PACKAGES, so any laxity made there on version matching won't affect custom types.
Type of change
test, version modification, documentation, etc.)
Checklist