Skip to content
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

Merged
merged 1 commit into from
Mar 3, 2022

Conversation

shawkins
Copy link
Contributor

@shawkins shawkins commented Feb 24, 2022

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

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@shawkins
Copy link
Contributor Author

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.

@shawkins
Copy link
Contributor Author

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.

@manusa manusa added the 5.12.x Backportable tentative label Mar 1, 2022
@sonarcloud
Copy link

sonarcloud bot commented Mar 1, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

80.9% 80.9% Coverage
0.0% 0.0% Duplication

@manusa manusa requested a review from oscerd March 2, 2022 11:24
Comment on lines +34 to +36
## 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.
Copy link
Member

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

@manusa manusa added this to the 6.0.0 milestone Mar 2, 2022
@manusa manusa merged commit 3c8a074 into fabric8io:master Mar 3, 2022
@manusa manusa removed the 5.12.x Backportable tentative label Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Listing / loading a CAPI Cluster resource throws an exception
2 participants