You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WIP: Use a single cache for all dynamic controllers
Crossplane uses a controller engine to dynamically start claim and XR
controllers when a new XRD is installed.
Before this commit, each controller gets at least one cache. This is
because when I built this functionality, you couldn't stop a single
informer within a cache (a cache is basically a map of informers by
GVK).
When realtime composition is enabled, there are even more caches. One
per composed resource GVK. A GVK routed cache routes cache lookups to
these various delegate caches.
Meanwhile, controller-runtime recently made it possible to stop an
informer within a cache. It's also been possible to remove an event
handler from an informer for some time (since Kubernetes 1.26).
kubernetes-sigs/controller-runtime#2285kubernetes-sigs/controller-runtime#2046
This commit uses a single client, backed by a single cache, across all
dynamic controllers (specifically the definition, offered, claim, and
XR controllers).
Compared to the current implementation, this commit:
* Ensures all dynamic controllers use clients backed by the same cache
used to power watches (i.e. trigger reconciles).
* Takes fewer global locks when realtime compositions are enabled.
Locking is now mostly at the controller scope.
* Works with the breaking changes to source.Source introduced in
controller-runtime v0.18. :)
Notably when realtime compositions are enabled, XR controllers will get
XRs and composed resources from cache. Before this commit, their client
wasn't backed by a cache. They'd get resources directly from the API
server. Similarly, the claim controller will read claims from cache.
Finally, I think this makes the realtime composition code a little easier
to follow by consolodating it into the ControllerEngine, but that's
pretty subjective.
Signed-off-by: Nic Cope <[email protected]>
0 commit comments