Skip to content

Commit 509d984

Browse files
committed
Start informer
Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
1 parent 9429896 commit 509d984

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

pkg/reconciler/broker/controller.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ package broker
1818

1919
import (
2020
"context"
21+
"os"
22+
23+
"knative.dev/pkg/injection"
2124

2225
"knative.dev/eventing/pkg/auth"
2326

@@ -60,6 +63,12 @@ const (
6063

6164
var Tracer tracing.Tracer
6265

66+
func init() {
67+
if isTest := os.Getenv("IS_TEST"); isTest != "true" {
68+
injection.Default.RegisterInformer()
69+
}
70+
}
71+
6372
// NewController initializes the controller and is called by the generated code
6473
// Registers event handlers to enqueue events
6574
func NewController(
@@ -69,7 +78,12 @@ func NewController(
6978
logger := logging.FromContext(ctx)
7079
brokerInformer := brokerinformer.Get(ctx)
7180
subscriptionInformer := subscriptioninformer.Get(ctx)
72-
endpointsInformer := namespacedinformerfactory.Get(ctx).Core().V1().Endpoints()
81+
82+
endpointsInformer := namespacedinformerfactory.Get(ctx).Core().V1().Endpoints().Informer()
83+
if err := controller.StartInformers(ctx.Done(), endpointsInformer); err != nil {
84+
logger.Fatalw("Failed to start namespaced endpoints informer", zap.Error(err))
85+
}
86+
7387
configmapInformer := configmapinformer.Get(ctx)
7488
secretInformer := secretinformer.Get(ctx)
7589
eventPolicyInformer := eventpolicyinformer.Get(ctx)

0 commit comments

Comments
 (0)