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: namespaced kruise-controller panic due to multiNamespaceCache #1773

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

Conversation

chengjoey
Copy link
Contributor

Ⅰ. Describe what this PR does

if set namespace, mgr will use multiNamespaceCache, it use informer not shardIndexInformer

Ⅱ. Does this pull request fix one issue?

fix #1764

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

@chengjoey
Copy link
Contributor Author

/assign @hantmac

switch informer.(type) {
case cache.SharedIndexInformer:
return informer.(cache.SharedIndexInformer).GetIndexer()
case toolscache.Informer:
Copy link
Member

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.

Copy link
Contributor Author

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>
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Project coverage is 49.30%. Comparing base (0d0031a) to head (b1cd825).
Report is 94 commits behind head on master.

Files with missing lines Patch % Lines
...g/controller/statefulset/statefulset_controller.go 0.00% 5 Missing ⚠️
pkg/controller/daemonset/daemonset_controller.go 0.00% 4 Missing ⚠️
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     
Flag Coverage Δ
unittests 49.30% <0.00%> (+1.39%) ⬆️

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.

if err != nil {
panic(err)
}
return cache.NewIndexer(cache.DeletionHandlingMetaNamespaceKeyFunc, indexers)
Copy link
Member

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.

@furykerry
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] namespaced kruise-controller panics
3 participants