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

runtime.Object apiVersion/kind is empty #3288

Merged
merged 1 commit into from
Mar 17, 2023
Merged

runtime.Object apiVersion/kind is empty #3288

merged 1 commit into from
Mar 17, 2023

Conversation

xigang
Copy link
Member

@xigang xigang commented Mar 16, 2023

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
When using a typed client, decoding to a versioned struct (not an internal API type), the apiVersion/kind information will be dropped. Therefore, the APIVersion/Kind information of runtime.Object needs to be verified.
See issue: kubernetes/kubernetes#80609

Which issue(s) this PR fixes:
Fixes #3275

Special notes for your reviewer:
@RainbowMango @whitewindmills

Does this PR introduce a user-facing change?:

NONE

@karmada-bot karmada-bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Mar 16, 2023
@karmada-bot karmada-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 16, 2023
@xigang
Copy link
Member Author

xigang commented Mar 17, 2023

/cc @RainbowMango @Garrybest

@chaunceyjiang
Copy link
Member

Just a question,will this change break compatibility?

@RainbowMango
Copy link
Member

Just a question,will this change break compatibility?

Good question.
My understanding is we don't provide compatibility guarantees at function level right now.
Speaking of this change, given the ClusterWideKeyFunc aims to generate cluster-wide-key, the apiversion and kind are both necessary filed. So I think this patch is a kind of protection, it doesn't change the interface.

Signed-off-by: xigang <wangxigang2014@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Merging #3288 (a45711b) into master (2fb2a84) will decrease coverage by 0.02%.
The diff coverage is 0.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #3288      +/-   ##
==========================================
- Coverage   49.40%   49.39%   -0.02%     
==========================================
  Files         207      207              
  Lines       18499    18505       +6     
==========================================
  Hits         9140     9140              
- Misses       8865     8869       +4     
- Partials      494      496       +2     
Flag Coverage Δ
unittests 49.39% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/util/fedinformer/keys/keys.go 73.77% <0.00%> (-8.05%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @chaunceyjiang Do you have any other comments?

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 17, 2023
@chaunceyjiang
Copy link
Member

/lgtm

@@ -74,7 +74,18 @@ func ClusterWideKeyFunc(obj interface{}) (ClusterWideKey, error) {
return key, fmt.Errorf("object has no meta: %v", err)
}

// When using a typed client, decoding to a versioned struct (not an internal API type), the apiVersion/kind
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is APIVersion/Kind information of runtime.Object filled in when we using dynamic client?

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

Thanks, @xigang and welcome to Karmada.

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 17, 2023
@karmada-bot karmada-bot merged commit 40c202b into karmada-io:master Mar 17, 2023
@RainbowMango RainbowMango changed the title bugfix: runtime.Object apiVersion/kind is empty runtime.Object apiVersion/kind is empty Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ClusterWideKeyFunc don't get runtime.Object GVK
6 participants