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

hasResource should return whether resource is matched not cached #5662

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yanfeng1992
Copy link
Member

@yanfeng1992 yanfeng1992 commented Oct 10, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

For detailed information of in tree plugins' execution order, please see:
// https://github.com/karmada-io/karmada/tree/master/docs/proposals/resource-aggregation-proxy#request-routing

image

But in fact, I found that if the requested resource is defined in ResourceRegistry but there is no cluster, the query is the resource of the karmada apiserver

image

apiVersion: search.karmada.io/v1alpha1
kind: ResourceRegistry
metadata:
  name: test
spec:
  resourceSelectors:
  - apiVersion: v1
    kind: Node
  - apiVersion: v1
    kind: Pod
  - apiVersion: v1
    kind: Namespace

This will cause two problems

case1.When there is no cluster registered, the query resource comes from karmada-apiserver

case2.When using watch, after deleting all clusters, watch will fail

image

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-search`: Modify the logic of checking whether the resource is registered when selecting the plugin .

@karmada-bot karmada-bot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 10, 2024
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 10, 2024
@yanfeng1992 yanfeng1992 force-pushed the fix-search-match-resource branch 2 times, most recently from d30991e to d6faa81 Compare October 10, 2024 08:16
@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 38.25%. Comparing base (e76ce63) to head (e7b6513).
Report is 142 commits behind head on master.

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5662      +/-   ##
==========================================
+ Coverage   34.14%   38.25%   +4.10%     
==========================================
  Files         643      649       +6     
  Lines       44522    45126     +604     
==========================================
+ Hits        15204    17264    +2060     
+ Misses      28162    26554    -1608     
- Partials     1156     1308     +152     
Flag Coverage Δ
unittests 38.25% <100.00%> (+4.10%) ⬆️

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

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

@XiShanYongYe-Chang
Copy link
Member

/assign

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from xishanyongye-chang. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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~
/lgtm
/assign @ikaven1024

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2024
@XiShanYongYe-Chang
Copy link
Member

Hi @yanfeng1992, can you help add the release note? Maybe we need to cherry-pick this patch to the previous branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants