-
Notifications
You must be signed in to change notification settings - Fork 928
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
feat(detector): resource detector matched policy potimization #5802
base: master
Are you sure you want to change the base?
feat(detector): resource detector matched policy potimization #5802
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 |
7527032
to
cfc8912
Compare
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 #5802 +/- ##
==========================================
+ Coverage 47.97% 48.05% +0.07%
==========================================
Files 674 674
Lines 55841 55823 -18
==========================================
+ Hits 26789 26825 +36
+ Misses 27305 27254 -51
+ Partials 1747 1744 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
does Is it possible that there is a policy in the In that case, if the creation time of |
my guass maybe correct, as you see corresponding detector log 2024-11-11T08:19:26.656651192Z stderr F I1111 08:19:26.656575 1 detector.go:236] Reconciling object: apps/v1, kind=Deployment, karmadatest-xnw86/deploy-4dpmc
2024-11-11T08:19:26.656739492Z stderr F I1111 08:19:26.656663 1 detector.go:919] PropagationPolicy(karmadatest-xnw86/deploy-4dpmc) has been added or updated.
2024-11-11T08:19:26.65699674Z stderr F I1111 08:19:26.656902 1 detector.go:361] Attempts to match policy for resource(apps/v1, kind=Deployment, karmadatest-xnw86/deploy-4dpmc)
2024-11-11T08:19:26.657175843Z stderr F I1111 08:19:26.657084 1 compare.go:66] No propagationpolicy match for resource(apps/v1, kind=Deployment, karmadatest-xnw86/deploy-4dpmc)
2024-11-11T08:19:26.657185351Z stderr F I1111 08:19:26.657101 1 detector.go:378] Attempts to match cluster policy for resource(apps/v1, kind=Deployment, karmadatest-xnw86/deploy-4dpmc)
2024-11-11T08:19:26.65742698Z stderr F I1111 08:19:26.657118 1 detector.go:386] No clusterpropagationpolicy find.
2024-11-11T08:19:26.660140465Z stderr F I1111 08:19:26.660036 1 detector.go:1160] Matched 0 resources by policy(karmadatest-xnw86/deploy-4dpmc)
2024-11-11T08:19:26.660781832Z stderr F I1111 08:19:26.660194 1 detector.go:785] Add object(apps/v1, kind=Deployment, karmadatest-xnw86/deploy-4dpmc) to waiting list, length of list is: 215
2024-11-11T08:19:26.667659376Z stderr F I1111 08:19:26.666134 1 detector.go:236] Reconciling object: apps/v1, kind=Deployment, karmadatest-xnw86/deploy-4dpmc
2024-11-11T08:19:26.667677359Z stderr F I1111 08:19:26.666184 1 detector.go:361] Attempts to match policy for resource(apps/v1, kind=Deployment, karmadatest-xnw86/deploy-4dpmc)
2024-11-11T08:19:26.667682419Z stderr F I1111 08:19:26.666302 1 compare.go:66] No propagationpolicy match for resource(apps/v1, kind=Deployment, karmadatest-xnw86/deploy-4dpmc)
2024-11-11T08:19:26.667686015Z stderr F I1111 08:19:26.666311 1 detector.go:378] Attempts to match cluster policy for resource(apps/v1, kind=Deployment, karmadatest-xnw86/deploy-4dpmc)
2024-11-11T08:19:26.667689341Z stderr F I1111 08:19:26.666326 1 detector.go:386] No clusterpropagationpolicy find.
2024-11-11T08:19:26.667692678Z stderr F I1111 08:19:26.666461 1 policy.go:98] No matched policy for object: apps/v1, kind=Deployment, karmadatest-xnw86/deploy-4dpmc |
Both obtain resource objects from the cache. I think If d.Client has this problem, d.InformerManager may also have it. |
5761d96
to
a03b852
Compare
You are advised to obtain the policy list from karmada-apiserver and check the performance consumption caused by karmada-apiserver to see if the benefits are greatly improved. |
8e1d81b
to
a3b488b
Compare
a3b488b
to
fe7afcd
Compare
c345c81
to
0345eed
Compare
/retest |
Is the purpose of this PR to remove the dependency on unstructured? |
If controller-runtime is used, the logic of resource detector resources entering the workqueue also needs to use controller-runtime. |
This is not the case... I tried replacing the generic InformerManger with the controller-runtime cache and it passes all the tests and works perfectly. This did not require replacing the asyncWorker, just replacing the lister and informer was enough. Here is the code: ctripcloud@e358fd1 |
you replaced the informer with controller-runtime, so you think use controller-runtime is better than genericInformer? What do you think? |
Yes, because controller-runtime informer is also a typed informer. |
What do you think? @XiShanYongYe-Chang |
0345eed
to
e4064c0
Compare
566a305
to
d6d5308
Compare
if err != nil { | ||
klog.Errorf("Failed to add event handler for ClusterPropagationPolicy: %v", err) | ||
return err | ||
} |
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.
you need to put those two AddEventHandler()
after the d.Processor.Run(d.ConcurrentResourceTemplateSyncs, d.stopCh)
, because AddEventHandler()
will immediately start the workers, and in the end of the workers logic, they will call d.Processor.Add()
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.
you mean d.Processor must run before d.ReconcilePropagationPolicy or d.ReconcileClusterPropagationPolicy trigger logic? If d.Processor has not been created, d.Processor.Add() might have problems?
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.
yes, occasional panic on startup
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.
I got it, tks
/retest |
d6d5308
to
962701d
Compare
Signed-off-by: chang.qiangqiang <chang.qiangqiang@immomo.com>
962701d
to
23dc788
Compare
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
part of #5790
Special notes for your reviewer:
Does this PR introduce a user-facing change?: