Skip to content

Commit

Permalink
Add promote filter function to Broker and Trigger reconciler
Browse files Browse the repository at this point in the history
When a reconciler gets promoted to be the leader, every object
gets re-queued even if it shouldn't be.

Signed-off-by: Pierangelo Di Pilato <pdipilat@redhat.com>
  • Loading branch information
pierDipi committed Dec 15, 2021
1 parent 2e8d011 commit 6da1be0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion control-plane/pkg/reconciler/broker/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ func NewController(ctx context.Context, watcher configmap.Watcher, env *config.E
)
}

impl := brokerreconciler.NewImpl(ctx, reconciler, kafka.BrokerClass)
impl := brokerreconciler.NewImpl(ctx, reconciler, kafka.BrokerClass, func(impl *controller.Impl) controller.Options {
return controller.Options{PromoteFilterFunc: kafka.BrokerClassFilter()}
})

reconciler.Resolver = resolver.NewURIResolverFromTracker(ctx, impl.Tracker)
reconciler.Prober = prober.NewAsync(ctx, http.DefaultClient, env.IngressPodPort, reconciler.ReceiverSelector(), impl.EnqueueKey)
Expand Down
1 change: 1 addition & 0 deletions control-plane/pkg/reconciler/trigger/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func NewController(ctx context.Context, _ configmap.Watcher, configs *config.Env
FinalizerName: FinalizerName,
AgentName: ControllerAgentName,
SkipStatusUpdates: false,
PromoteFilterFunc: filterTriggers(reconciler.BrokerLister),
}
})

Expand Down
1 change: 1 addition & 0 deletions control-plane/pkg/reconciler/trigger/v2/controllerv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func NewControllerV2(ctx context.Context, configs *config.Env) *controller.Impl
FinalizerName: FinalizerName,
AgentName: ControllerAgentName,
SkipStatusUpdates: false,
PromoteFilterFunc: filterTriggers(reconciler.BrokerLister),
}
})

Expand Down

0 comments on commit 6da1be0

Please sign in to comment.