k8s
k8s copied to clipboard
JIT HTTP Caching
Cheaped out and skipped caching for the HTTP Provider. Importante
In Go SDKs and the kube
Rust crate there are concepts called Informers and Reflectors. IIUC Informers are sort of a once-per-controller feed of changes to a certain resource type that various components react to through subscription. Reflectors are a sort of read-through hot cache that stores a local copy of the full list of a resource type, will answer queries from that, and can refresh on demand. In between deliberate refreshes it watches the same event stream that an Informer does (and much like Bonny uses).
In a similar vein to my comment on #10: I have some ideas around implementing these on top of the Watch abstraction, then emitting those events via Registry.dispatch
to separate processes that do further fan-out in an Informer's case or do some internal cache book-keeping in a Reflector's case.
Grab bag of reference links:
- https://github.com/kubernetes/kubernetes/blob/82cb4c17581752ae9f00bd746a63e529149c04b4/pkg/client/cache/reflector.go
- https://engineering.bitnami.com/articles/a-deep-dive-into-kubernetes-controllers.html
- https://gianarb.it/blog/kubernetes-shared-informer
- https://borismattijssen.github.io/articles/kubernetes-informers-controllers-reflectors-stores
- https://github.com/clux/kube-rs/blob/master/kube/src/runtime/informer.rs
- https://github.com/clux/kube-rs/blob/50fe50a77af3628bb92311a764060aeaca0f6e08/kube/examples/pod_informer.rs#L16-L27
- https://github.com/clux/kube-rs/blob/master/kube/src/runtime/reflector.rs
- https://github.com/clux/kube-rs/blob/50fe50a77af3628bb92311a764060aeaca0f6e08/kube/examples/pod_reflector.rs#L22-L27