Only reconcile CRDs labeled with the duck key/value
On controller promotion (which happens on installation) the source
controller is attempting to reconcile all CRDs. This change will do
in-memory filtering to exclude those that do not match the filter.
@@ -49,15 +49,17 @@ func NewController(
ogcmw: cmw,
controllers: make(map[schema.GroupVersionResource]runningController),
}
+ filterFunc := pkgreconciler.LabelFilterFunc(sources.SourceDuckLabelKey, sources.SourceDuckLabelValue, false)
impl := crdreconciler.NewImpl(ctx, r, func(impl *controller.Impl) controller.Options {
return controller.Options{
AgentName: ReconcilerName,
+ PromoteFilterFunc: filterFunc,
}
})
logger.Info("Setting up event handlers")
crdInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{
- FilterFunc: pkgreconciler.LabelFilterFunc(sources.SourceDuckLabelKey, sources.SourceDuckLabelValue, false),
+ FilterFunc: filterFunc,
Handler: controller.HandleAll(impl.Enqueue),
})
