kube
kube copied to clipboard
allow filtering watcher events when !observedGeneration changed
rationale: we don't necessarily want to receive events when the .status object changes
This would require maintaining a map of ObjectRef -> observedGeneration (int) inside a watcher / reflector and checking if it changed before bubbling up the event (first added event would always succeed)
Not quite what the best way to extend this, it's not very nice to have this in the internal watcher state by default, so need to have this optional somehow. It's a bit of a niche feature, and honestly, mostly for controllers to filter out its own modifications, so probably should think about this holistically in #279
PoC in https://github.com/kube-rs/controller-rs/commit/7e2a15274d0ef99a3b7c841446bc104535ed2118 using the impl trait magic that @teozkr brought for runtime conditions. I think this is viable in terms of inclusion, but there's probably some cleanups. Feel free to drop some comments, otherwise I'll prepare a PR for that and await reviews then.