Skip to content

Commit

Permalink
Add promote filter function to Broker and Trigger reconciler (#1653)
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 <[email protected]>
  • Loading branch information
pierDipi authored Dec 23, 2021
1 parent a893020 commit 3b057ce
Show file tree
Hide file tree
Showing 2 changed files with 4 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 @@ -94,7 +94,9 @@ func NewController(ctx context.Context, watcher configmap.Watcher, configs *Conf
reconciler.SetBootstrapServers(configs.BootstrapServers)
}

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)

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

0 comments on commit 3b057ce

Please sign in to comment.