openkruise / kruise

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

[BUG] namespaced kruise-controller panics #1764

Open miklezzzz opened 1 month ago

miklezzzz commented 1 month ago

What happened: If --namespace flag is set (e.g., --namespace=kruise-system), the controller of v1.7.x panics on startup with the following stacktrace:

I0927 15:42:21.569651       1 reflector.go:325] Listing and watching *v1.ControllerRevision from pkg/mod/k8s.io/client-go@v0.28.9/tools/cache/reflector.go:229
I0927 15:42:21.670294       1 shared_informer.go:341] caches populated
panic: interface conversion: *cache.multiNamespaceInformer is not cache.SharedIndexInformer: missing method GetController

goroutine 176 [running]:
github.com/openkruise/kruise/pkg/controller/daemonset.newReconciler({0x2c5d3c8, 0xc000129520})
    /workspace/pkg/controller/daemonset/daemonset_controller.go:175 +0x46a
github.com/openkruise/kruise/pkg/controller/daemonset.Add({0x2c5d3c8, 0xc000129520})
    /workspace/pkg/controller/daemonset/daemonset_controller.go:141 +0x13a
github.com/openkruise/kruise/pkg/controller.SetupWithManager({0x2c5d3c8, 0xc000129520})
    /workspace/pkg/controller/controllers.go:74 +0x82
main.main.func2()
    /workspace/main.go:252 +0x12d
created by main.main
    /workspace/main.go:244 +0x142a

What you expected to happen:

How to reproduce it (as minimally and precisely as possible): see above

Anything else we need to know?:

Environment:

hantmac commented 1 month ago

@miklezzzz The code may switch to using multiNamespaceInformer instead of the standard SharedIndexInformer. multiNamespaceInformer implements the SharedInformer interface, but is not fully compatible with the SharedIndexInformer interface. We will fix this issue.