-
Notifications
You must be signed in to change notification settings - Fork 914
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
add APIVersion and Kind checks for helper.ToUnstructured() #6028
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #6028 +/- ##
==========================================
- Coverage 48.37% 48.23% -0.15%
==========================================
Files 665 666 +1
Lines 54836 54843 +7
==========================================
- Hits 26526 26451 -75
- Misses 26592 26681 +89
+ Partials 1718 1711 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: zach593 <zach_li@outlook.com>
b9d880b
to
3afc187
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.
/assign
What type of PR is this?
/kind bug
What this PR does / why we need it:
This issue blocks me to continue #6017.
In function
helper.ToUnstructured()
, karmada will convert other types of object tounstructured.Unstructured
, but if object is missedTypeMeta
, the generatedunstructured.Unstructured
will also missedAPIVersion
andKind
, of course in most of the time these are harmful.Missing
TypeMeta
objects usually come from typed clients or objects that manually created in code.In kubernetes issue kubernetes/client-go#541 talked about typed client , looks like these guys won't fix this.
This issue affected many tests, and caused some tests to falsely report success. I fixed all the affected code I could see, but there may be still some I haven't noticed. This may also have an impact in non-test code, which I need to confirm further.
After fixing all the affected codes, I think adding an APIVersion and Kind checks to helper.ToUnstructured() can prevent the impact from expanding further. However, this check obviously needs to be added after ensuring that all the affected codes have been modified to avoid causing a stronger impact.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: