Skip to content

Informer Pools #2415

@csviri

Description

@csviri

In some cases, informers might be shared especially between controllers. So if multiple controllers watch same resource (with same label selectors, namespaces, item store ) sharing it would spare resources

 flowchart LR
      subgraph Controllers
        CA[Controller A]
        CB[Controller B]
        CC[Controller C]
      end

      subgraph EventSources["InformerEventSources"]
        ESA[IES A]
        ESB[IES B]
        ESC[IES C]
      end

      subgraph Managers["InformerManagers"]
        MA[InformerManager A]
        MB[InformerManager B]
        MC[InformerManager C]
      end
  
      Pool[(DefaultInformerPool<br/>InformerClassifier → SharedIndexInformer<br/>+ refCount)]

      SII1[SharedIndexInformer<br/>Pod / ns=foo / selector=app=x]
      SII2[SharedIndexInformer<br/>ConfigMap / all-ns]

      K8s[(Kubernetes API)]

      CA --> ESA --> MA -- "getResource(classifier)" --> Pool
      CB --> ESB --> MB -- "getResource(classifier)" --> Pool
      CC --> ESC --> MC -- "getResource(classifier)" --> Pool

      Pool -- "shared (refCount=2)" --> SII1
      Pool -- "refCount=1" --> SII2

      MA -. handler .-> SII1
      MB -. handler .-> SII1

      CA --> ESA --> MA -- "getResource(classifier)" --> Pool
      CB --> ESB --> MB -- "getResource(classifier)" --> Pool
      CC --> ESC --> MC -- "getResource(classifier)" --> Pool

      Pool -- "shared (refCount=2)" --> SII1
      Pool -- "refCount=1" --> SII2

      MA -. handler .-> SII1
      MB -. handler .-> SII1
      MC -. handler .-> SII2

      SII1 <--> K8s
      SII2 <--> K8s



Loading

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions