Skip to content

Informer Pools #2415

Description

@csviri

How it works

  • An informer's identity is captured by an InformerClassifier composed 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.
  • informerListLimit is 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-ConfigurationService singleton); AbstractConfigurationService caches it.

Tasks

  • InformerPool abstraction + DefaultInformerPool (sharing, reference-counted) and AlwaysNewInformerPool
  • ConfigurationServiceOverrider.withInformerPool(...)
  • Integration tests: basic sharing, dynamic registration, de-registration/release — run against both pool strategies
  • Unit tests: classifier equality, reference counting
  • Documentation

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions