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: cannot access ResourceRegistry with its singularName #4144

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

zhzhuang-zju
Copy link
Contributor

@zhzhuang-zju zhzhuang-zju commented Oct 18, 2023

What type of PR is this?

What this PR does / why we need it:
Referring to #4141
we cannot access resource ResourceRegistry with its singularName.

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

Special notes for your reviewer:
none

Does this PR introduce a user-facing change?:

`karmada-search`: Fixed can not access ResourceRegistry issue due to misconfigured singular name.

@karmada-bot karmada-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 18, 2023
@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (557348f) 53.48% compared to head (61302b5) 53.48%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4144   +/-   ##
=======================================
  Coverage   53.48%   53.48%           
=======================================
  Files         234      234           
  Lines       23304    23304           
=======================================
  Hits        12465    12465           
- Misses      10157    10158    +1     
+ Partials      682      681    -1     
Flag Coverage Δ
unittests 53.48% <0.00%> (ø)

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

Files Coverage Δ
pkg/registry/search/storage/resourceregistry.go 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@karmada-bot karmada-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 18, 2023
@XiShanYongYe-Chang
Copy link
Member

Can you help post your test report?

@zhzhuang-zju
Copy link
Contributor Author

zhzhuang-zju commented Oct 19, 2023

Can you help post your test report?

Certainly!

➜  karmada git:(master) ✗ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get ResourceRegistry
NAME                CREATED AT
deployment-search   2023-10-17T11:40:36Z
➜  karmada git:(master) ✗ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get resourceregistries
NAME                CREATED AT
deployment-search   2023-10-17T11:40:36Z

Executing kubectl get resourceregisty runs as well as executing kubectl get resourceregistries.

Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

Thanks a lot~
/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2023
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XiShanYongYe-Chang

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 Oct 20, 2023
@karmada-bot karmada-bot merged commit a98d5fd into karmada-io:master Oct 20, 2023
12 checks passed
@XiShanYongYe-Chang
Copy link
Member

We need to cherry-pick this patch to the previous branch, I will create an issue to track this.

@RainbowMango
Copy link
Member

@zhzhuang-zju Have you ever thought about if this patch would block the upgrade?
For example, there is a ResourceRegistry resource that was created in the previous version, like v1.7.0, I'm not sure if there is a problem when upgrading the karmada-aggregated-apiserver.

Can you help to confirm that?

@zhzhuang-zju
Copy link
Contributor Author

Nice finding! It is necessary to verify the upgrade scenario, and I‘d like to confirm it.

karmada-bot added a commit that referenced this pull request Oct 20, 2023
…4144-upstream-release-1.5

Automated cherry pick of #4144: fix: cannot access ResourceRegistry with its singularName
karmada-bot added a commit that referenced this pull request Oct 21, 2023
…4144-upstream-release-1.6

Automated cherry pick of #4144: fix: cannot access ResourceRegistry with its singularName
karmada-bot added a commit that referenced this pull request Oct 21, 2023
…4144-upstream-release-1.7

Automated cherry pick of #4144: fix: cannot access ResourceRegistry with its singularName
@zhzhuang-zju
Copy link
Contributor Author

I did some experiments and found that there is indeed a problem in the upgrade scenario.
Specific steps are as follows,

  1. use version release-1.7.0 to build the karmada environment
  2. Create ResourceRegistry with command kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver create -f deployment-search.yaml
### deployment-search.yaml
apiVersion: search.karmada.io/v1alpha1
kind: ResourceRegistry
metadata:
  name: deployment-search
spec:
  targetCluster:
    clusterNames:
      - member1
      - member2
  resourceSelectors:
    - apiVersion: apps/v1
      kind: Deployment

3.Execute kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get ResourceRegistry

➜  templates kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get ResourceRegistry
error: the server doesn't have a resource type "ResourceRegistry"

4.Upgrade the component karmada-search with the latest image.
5.Execute kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get ResourceRegistry

➜  karmada git:(master) ✗ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get ResourceRegistry
No resources found

It seems that it can't find the resource with kind: ResourceRegistry that was released before the upgrade.
In addition, I found that when the code in line 31 of file pkg/registry/search/storage/resourceregistry.go is changed to DefaultQualifiedResource: searchapis.Resource("resourceRegistries"),, the upgrade problem seems to be solved.

➜  karmada git:(master) ✗ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get ResourceRegistry  
NAME                CREATED AT
deployment-search   2023-10-21T11:20:04Z
➜  karmada git:(master) ✗ kubectl --kubeconfig $HOME/.kube/karmada.config --context karmada-apiserver get resourceregistries
NAME                CREATED AT
deployment-search   2023-10-21T11:20:04Z

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. 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.

bug: cannot access ResourceRegistry with its singularName
5 participants