Closed zugao closed 3 years ago
I've allowed myself to edit your comment a bit.
I've had an implementation idea how to limit reconciles to a single namespace:
Reconcile(...)
on the SyncConfigReconciler for all SyncConfigs found in the espejo namespace (from within the namespace controller reconcile
func).filterNamespaces
in https://github.com/vshn/espejo/blob/master/controllers/syncconfig_utils.go#L46, so that it only returns the namespace from the given property if it is non-empty.Thoughts?
I like this approach. Probably it doesn't even need a custom controller, just an adapted handler.EnqueueRequestsFromMapFunc
function: https://github.com/vshn/espejo/blob/master/controllers/syncconfig_controller.go#L64
I also thought of that, but I'm a bit afraid of side effects when modifying the same SyncConfigReconciler that is also used for normal reconciliations. The Map function basically translates the namespace event into a list of reconcile requests for the sync configs in the namespace. But then the controller-runtime calls Reconcile
at later, unknown time in an unknown order in a queue (from the point of the Map function). How exactly would you modify the Map function so that the Reconcile
function respects only a single namespace?
With a dedicated controller, we probably don't need the map function anymore, resp. much of that logic will be part of the controller anyway.
I have edited the issue a bit
Summary
As cluster-admin\ I want to limit the scope of a namespace-triggered reconcile of SyncConfigs to the source namespace\ So that I can reduce the load on the Kubernetes API on large clusters.
Context
The namespace watcher feature of Espejo has a flaw. On every namespace update, the SyncConfigs are reconciled for all other namespaces as well. This situation is expensive on big clusters (1000+ dynamic namespaces), especially combined with a low
--recycling-interval
. It should be possible to limit SyncConfig reconcile to only the namespace where the trigger came from. Increasing the interval on clusters with highly dynamic namespaces doesn't matter anymore, since espejo is reconciling all the time triggered by namespace event.Out of Scope
SyncConfig
CRD for compatibility reasonsFurther links
24
Acceptance criteria
Implementation Ideas