Skip to content

Commit

Permalink
[release-1.11] Global resync brokers on config-features changes (#7134)
Browse files Browse the repository at this point in the history
This is an automated cherry-pick of #7126

---------

Signed-off-by: Pierangelo Di Pilato <[email protected]>
Co-authored-by: Pierangelo Di Pilato <[email protected]>
  • Loading branch information
knative-prow-robot and pierDipi authored Aug 2, 2023
1 parent d3a0faa commit 1a5f37c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pkg/reconciler/broker/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ func NewController(
configmapInformer := configmapinformer.Get(ctx)
secretInformer := secretinformer.Get(ctx)

featureStore := feature.NewStore(logging.FromContext(ctx).Named("feature-config-store"))
var globalResync func(obj interface{})

featureStore := feature.NewStore(logging.FromContext(ctx).Named("feature-config-store"), func(name string, value interface{}) {
if globalResync != nil {
globalResync(nil)
}
})
featureStore.WatchConfigs(cmw)

var err error
Expand Down Expand Up @@ -112,7 +118,7 @@ func NewController(
// When the endpoints in our multi-tenant filter/ingress change, do a global resync.
// During installation, we might reconcile Brokers before our shared filter/ingress is
// ready, so when these endpoints change perform a global resync.
grCb := func(obj interface{}) {
globalResync = func(obj interface{}) {
// Since changes in the Filter/Ingress Service endpoints affect all the Broker objects,
// do a global resync.
logger.Info("Doing a global resync due to endpoint changes in shared broker component")
Expand All @@ -123,18 +129,18 @@ func NewController(
FilterFunc: pkgreconciler.ChainFilterFuncs(
pkgreconciler.NamespaceFilterFunc(system.Namespace()),
pkgreconciler.NameFilterFunc(names.BrokerFilterName)),
Handler: controller.HandleAll(grCb),
Handler: controller.HandleAll(globalResync),
})
// Resync for the ingress.
endpointsInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{
FilterFunc: pkgreconciler.ChainFilterFuncs(
pkgreconciler.NamespaceFilterFunc(system.Namespace()),
pkgreconciler.NameFilterFunc(names.BrokerIngressName)),
Handler: controller.HandleAll(grCb),
Handler: controller.HandleAll(globalResync),
})
secretInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{
FilterFunc: controller.FilterWithName(ingressServerTLSSecretName),
Handler: controller.HandleAll(grCb),
Handler: controller.HandleAll(globalResync),
})

return impl
Expand Down

0 comments on commit 1a5f37c

Please sign in to comment.