From e5747a4c241d6c5a2f86bec83af83ed0608d9d3b Mon Sep 17 00:00:00 2001 From: Ian Milligan Date: Tue, 15 Sep 2020 17:36:41 -0700 Subject: [PATCH] Properly set system namespace when reconciling default brokercell (#1705) --- pkg/reconciler/brokercell/controller.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/reconciler/brokercell/controller.go b/pkg/reconciler/brokercell/controller.go index 7f6851a19a..e0a3ad99f2 100644 --- a/pkg/reconciler/brokercell/controller.go +++ b/pkg/reconciler/brokercell/controller.go @@ -46,6 +46,7 @@ import ( serviceinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/service" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" + "knative.dev/pkg/system" ) const ( @@ -96,7 +97,7 @@ func NewController( func(obj interface{}) { if b, ok := obj.(*brokerv1beta1.Broker); ok { // TODO(#866) Select the brokercell that's associated with the given broker. - impl.EnqueueKey(types.NamespacedName{Namespace: b.Namespace, Name: brokerresources.DefaultBrokerCellName}) + impl.EnqueueKey(types.NamespacedName{Namespace: system.Namespace(), Name: brokerresources.DefaultBrokerCellName}) reportLatency(ctx, b, latencyReporter, "Broker", b.Name, b.Namespace) } }, @@ -104,13 +105,8 @@ func NewController( triggerinformer.Get(ctx).Informer().AddEventHandler(controller.HandleAll( func(obj interface{}) { if t, ok := obj.(*brokerv1beta1.Trigger); ok { - b, err := brokerinformer.Get(ctx).Lister().Brokers(t.Namespace).Get(t.Spec.Broker) - if err != nil { - logging.FromContext(ctx).Error("Failed to get broker", zap.Error(err)) - return - } // TODO(#866) Select the brokercell that's associated with the given broker. - impl.EnqueueKey(types.NamespacedName{Namespace: b.Namespace, Name: brokerresources.DefaultBrokerCellName}) + impl.EnqueueKey(types.NamespacedName{Namespace: system.Namespace(), Name: brokerresources.DefaultBrokerCellName}) reportLatency(ctx, t, latencyReporter, "Trigger", t.Name, t.Namespace) } },