Repository navigation
Informer Pools #2415
Copy link
Copy link
Closed
Milestone
Description
How it works
- An informer's identity is captured by an
InformerClassifiercomposed of:- target cluster (API server URL, including the remote client used for multi-cluster event sources)
- resource type (or group/version/kind for generic resources)
- watched namespace
- label, field, and shard selectors
- configured item store
- Event sources whose classifiers are equal share one
SharedIndexInformer. - The pool is reference-counted: the informer is created on first use and stopped only when the last user releases it.
informerListLimitis intentionally not part of the identity — if two otherwise-equivalent sources request different limits, the existing informer is reused (a warning is logged, first-configured limit wins).- Indexers are not part of the identity, since they can be added to a shared informer independently (avoid indexer name collisions).
- Works with dynamic event source registration: registering a source for a resource already backed by a running informer reuses it, and the informer replays its current cache to the newly added handler so initial state is
not missed.
API / configuration
New strategy interface InformerPool with two implementations:
DefaultInformerPool(default) — shares informers as described above.AlwaysNewInformerPool— never shares; one informer per event source (previous behavior). Use to opt out.
Selectable via the configuration service:
Operator operator = new Operator(overrider ->
overrider.withInformerPool(new AlwaysNewInformerPool()));Status / notes
- Marked
@Experimental: the runtime behavior is production-ready, but the configuration API may still change in a non-backwards-compatible way. ConfigurationService.informerPool()must return the same instance per config service (a per-ConfigurationServicesingleton);AbstractConfigurationServicecaches it.
Tasks
-
InformerPoolabstraction +DefaultInformerPool(sharing, reference-counted) andAlwaysNewInformerPool -
ConfigurationServiceOverrider.withInformerPool(...) - Integration tests: basic sharing, dynamic registration, de-registration/release — run against both pool strategies
- Unit tests: classifier equality, reference counting
- Documentation
Reactions are currently unavailable
Activity
csviri commentedon Oct 25, 2024
This will be needed for this.
fabric8io/kubernetes-client#6501 ✔️