-
Notifications
You must be signed in to change notification settings - Fork 768
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: namespaced kruise-controller panic due to multiNamespaceCache
#1773
base: master
Are you sure you want to change the base?
Conversation
/assign @hantmac |
pkg/controller/util/cache.go
Outdated
switch informer.(type) { | ||
case cache.SharedIndexInformer: | ||
return informer.(cache.SharedIndexInformer).GetIndexer() | ||
case toolscache.Informer: |
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.
This code will always match the toolscache.Informer
case, because the function param type is toolscache.Informer
.
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.
done
Signed-off-by: joey <zchengjoey@gmail.com>
273906e
to
b1cd825
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1773 +/- ##
==========================================
+ Coverage 47.91% 49.30% +1.39%
==========================================
Files 162 191 +29
Lines 23491 19616 -3875
==========================================
- Hits 11256 9672 -1584
+ Misses 11014 8686 -2328
- Partials 1221 1258 +37
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
if err != nil { | ||
panic(err) | ||
} | ||
return cache.NewIndexer(cache.DeletionHandlingMetaNamespaceKeyFunc, indexers) |
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.
is it the recommended way to retrieve indexer of multi namespaced informer ? it seems rather tricky.
since controller-runtime is not design to be interface compatible with client-go, can we change the lister to controler-runtime client.List, then it is no need to specify the index explicitly. daemonset and statefulset use the lister for historical reason, possibly for easier integration with upstream controller code. |
Ⅰ. Describe what this PR does
if set namespace, mgr will use
multiNamespaceCache
, it useinformer
notshardIndexInformer
Ⅱ. Does this pull request fix one issue?
fix #1764
Ⅲ. Describe how to verify it
Ⅳ. Special notes for reviews