robusta-dev / kubewatch

Watch k8s events and trigger Handlers
Apache License 2.0
542 stars 79 forks source link

[feature] Support watch any k8s resource #79

Open Colvin-Y opened 5 days ago

Colvin-Y commented 5 days ago

User may want to watch their own crd objects, like advanced-statefulset in openkruise. Current object types is too few.\

Actually, if user config kube-watch controller rbac correcly, we can use k8s.io/client-go/dynamic/dynamicinformer to watch any unstructured object if we know it's gvk info (resources can be found by discovery client)\

By this implementation, pkg/controller/controller.go::Start() function will be more short and clear. We can remove so many if conf.Resource.XXX branch.

aantn commented 5 days ago

Hi @Colvin-Y, can you try this branch and let me know how it works for you?

https://github.com/robusta-dev/kubewatch/pull/76

Colvin-Y commented 5 days ago

Hi @Colvin-Y, can you try this branch and let me know how it works for you?

76

Hi @aantn, Uhuh,nice PR! implementation is same as what I think. I'd like to try it recently, may this weekend. \ Btw, why dont'u refactor controller.go to tidy so many if conf.Resource.XXX case. \

aantn commented 5 days ago

Yes, I think it it possible. It is quite an eyesore right now.