operator-framework / operator-controller

Apache License 2.0
28 stars 47 forks source link

Implement a dynamic caching layer that establishes watches utilizing a ServiceAccount #974

Open everettraven opened 1 week ago

everettraven commented 1 week ago

As part of managing installed content and reconciling any changes made to the managed content, we need to configure watches on the resources managed for a given ClusterExtension. After #971, given a ClusterExtension and the content to be managed, we can configure clients for establishing watches using the ServiceAccount specified in the ClusterExtension.

While the exact implementation may vary, the currently proposed approach is as follows:

For each ClusterExtension:

A mermaid graph to visualize the logical flow:

graph TD
    A(ClusterExtension)
    B(Content To Manage)
    C(Managed Content Cache)
    D(RestConfigMapper)
    E(rest.Config)
    F(cache.Cache)
    G(controller.Watch)
    J(ClusterExtension Reconciler)
    L(Watch)

    A -- Provided To --> C
    B -- Provided To --> C
    C -- Fetches Rest Config --> D
    D -- Creates for ServiceAccount --> E
    C -- Creates --> F
    E -- Provided To --> F
    F -- Provided To --> G
    G -- Creates --> L
    L -- Events Trigger --> J
    C -- Establishes Watch With --> G

Acceptance Criteria:

joelanford commented 6 days ago

Is it possible to wire up and use a controller-runtime cache-delegating client.Client per ClusterExtension, where we configure it with an http.Client with the custom http.RoundTripper?

everettraven commented 6 days ago

@joelanford I've updated the RFC and this issue to now reflect the ideal use of the existing controller-runtime caching layer APIs