openkruise / kruise

Automated management of large-scale applications on Kubernetes (incubating project under CNCF)
https://openkruise.io
Other
4.68k stars 770 forks source link

fix: namespaced kruise-controller panic due to `multiNamespaceCache` #1773

Open chengjoey opened 1 month ago

chengjoey commented 1 month ago

Ⅰ. 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 commented 1 month ago

/assign @hantmac

codecov[bot] commented 1 month ago

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 :warning:
pkg/controller/daemonset/daemonset_controller.go 0.00% 4 Missing :warning:
Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/openkruise/kruise/pull/1773/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openkruise) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/openkruise/kruise/pull/1773/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openkruise) | `49.30% <0.00%> (+1.39%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openkruise#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

furykerry commented 1 week ago

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.