From 6288b83d120e883d2d35af6c9a49387bac0dabd1 Mon Sep 17 00:00:00 2001 From: Kate Osborn Date: Thu, 12 Oct 2023 11:16:35 -0600 Subject: [PATCH] Add batch ID and inject loggers --- .../events/eventsfakes/fake_event_handler.go | 23 +++++++------- internal/framework/events/handler.go | 4 ++- internal/framework/events/loop.go | 12 ++++++-- internal/framework/events/loop_test.go | 11 +++---- internal/mode/provisioner/handler.go | 13 ++++---- internal/mode/provisioner/handler_test.go | 23 +++++++------- internal/mode/provisioner/manager.go | 1 - internal/mode/static/handler.go | 30 ++++++++++--------- internal/mode/static/handler_test.go | 27 ++++++++--------- internal/mode/static/manager.go | 1 - 10 files changed, 75 insertions(+), 70 deletions(-) diff --git a/internal/framework/events/eventsfakes/fake_event_handler.go b/internal/framework/events/eventsfakes/fake_event_handler.go index 0b0df59437..0f17b6a391 100644 --- a/internal/framework/events/eventsfakes/fake_event_handler.go +++ b/internal/framework/events/eventsfakes/fake_event_handler.go @@ -5,31 +5,34 @@ import ( "context" "sync" + "github.com/go-logr/logr" "github.com/nginxinc/nginx-gateway-fabric/internal/framework/events" ) type FakeEventHandler struct { - HandleEventBatchStub func(context.Context, events.EventBatch) + HandleEventBatchStub func(context.Context, logr.Logger, events.EventBatch) handleEventBatchMutex sync.RWMutex handleEventBatchArgsForCall []struct { arg1 context.Context - arg2 events.EventBatch + arg2 logr.Logger + arg3 events.EventBatch } invocations map[string][][]interface{} invocationsMutex sync.RWMutex } -func (fake *FakeEventHandler) HandleEventBatch(arg1 context.Context, arg2 events.EventBatch) { +func (fake *FakeEventHandler) HandleEventBatch(arg1 context.Context, arg2 logr.Logger, arg3 events.EventBatch) { fake.handleEventBatchMutex.Lock() fake.handleEventBatchArgsForCall = append(fake.handleEventBatchArgsForCall, struct { arg1 context.Context - arg2 events.EventBatch - }{arg1, arg2}) + arg2 logr.Logger + arg3 events.EventBatch + }{arg1, arg2, arg3}) stub := fake.HandleEventBatchStub - fake.recordInvocation("HandleEventBatch", []interface{}{arg1, arg2}) + fake.recordInvocation("HandleEventBatch", []interface{}{arg1, arg2, arg3}) fake.handleEventBatchMutex.Unlock() if stub != nil { - fake.HandleEventBatchStub(arg1, arg2) + fake.HandleEventBatchStub(arg1, arg2, arg3) } } @@ -39,17 +42,17 @@ func (fake *FakeEventHandler) HandleEventBatchCallCount() int { return len(fake.handleEventBatchArgsForCall) } -func (fake *FakeEventHandler) HandleEventBatchCalls(stub func(context.Context, events.EventBatch)) { +func (fake *FakeEventHandler) HandleEventBatchCalls(stub func(context.Context, logr.Logger, events.EventBatch)) { fake.handleEventBatchMutex.Lock() defer fake.handleEventBatchMutex.Unlock() fake.HandleEventBatchStub = stub } -func (fake *FakeEventHandler) HandleEventBatchArgsForCall(i int) (context.Context, events.EventBatch) { +func (fake *FakeEventHandler) HandleEventBatchArgsForCall(i int) (context.Context, logr.Logger, events.EventBatch) { fake.handleEventBatchMutex.RLock() defer fake.handleEventBatchMutex.RUnlock() argsForCall := fake.handleEventBatchArgsForCall[i] - return argsForCall.arg1, argsForCall.arg2 + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 } func (fake *FakeEventHandler) Invocations() map[string][][]interface{} { diff --git a/internal/framework/events/handler.go b/internal/framework/events/handler.go index 8c2cff4133..2d512c7ba7 100644 --- a/internal/framework/events/handler.go +++ b/internal/framework/events/handler.go @@ -2,6 +2,8 @@ package events import ( "context" + + "github.com/go-logr/logr" ) //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . EventHandler @@ -10,5 +12,5 @@ import ( type EventHandler interface { // HandleEventBatch handles a batch of events. // EventBatch can include duplicated events. - HandleEventBatch(ctx context.Context, batch EventBatch) + HandleEventBatch(ctx context.Context, logger logr.Logger, batch EventBatch) } diff --git a/internal/framework/events/loop.go b/internal/framework/events/loop.go index a7e8055047..3acda1c467 100644 --- a/internal/framework/events/loop.go +++ b/internal/framework/events/loop.go @@ -34,6 +34,9 @@ type EventLoop struct { // The batches are swapped before starting the handler goroutine. currentBatch EventBatch nextBatch EventBatch + + // the ID of the current batch + currentBatchID int } // NewEventLoop creates a new EventLoop. @@ -63,11 +66,14 @@ func (el *EventLoop) Start(ctx context.Context) error { handleBatch := func() { go func(batch EventBatch) { - el.logger.Info("Handling events from the batch", "total", len(batch)) + el.currentBatchID++ + batchLogger := el.logger.WithName("eventHandler").WithValues("batchID", el.currentBatchID) + + batchLogger.Info("Handling events from the batch", "total", len(batch)) - el.handler.HandleEventBatch(ctx, batch) + el.handler.HandleEventBatch(ctx, batchLogger, batch) - el.logger.Info("Finished handling the batch") + batchLogger.Info("Finished handling the batch") handlingDone <- struct{}{} }(el.currentBatch) } diff --git a/internal/framework/events/loop_test.go b/internal/framework/events/loop_test.go index ea53d9ade3..19a6f37440 100644 --- a/internal/framework/events/loop_test.go +++ b/internal/framework/events/loop_test.go @@ -4,6 +4,7 @@ import ( "context" "errors" + "github.com/go-logr/logr" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "sigs.k8s.io/controller-runtime/pkg/log/zap" @@ -47,7 +48,7 @@ var _ = Describe("EventLoop", func() { // Ensure the first batch is handled Eventually(fakeHandler.HandleEventBatchCallCount).Should(Equal(1)) - _, batch = fakeHandler.HandleEventBatchArgsForCall(0) + _, _, batch = fakeHandler.HandleEventBatchArgsForCall(0) var expectedBatch events.EventBatch = []interface{}{"event0"} Expect(batch).Should(Equal(expectedBatch)) @@ -70,7 +71,7 @@ var _ = Describe("EventLoop", func() { eventCh <- e Eventually(fakeHandler.HandleEventBatchCallCount).Should(Equal(2)) - _, batch := fakeHandler.HandleEventBatchArgsForCall(1) + _, _, batch := fakeHandler.HandleEventBatchArgsForCall(1) var expectedBatch events.EventBatch = []interface{}{e} Expect(batch).Should(Equal(expectedBatch)) @@ -82,7 +83,7 @@ var _ = Describe("EventLoop", func() { // The func below will pause the handler goroutine while it is processing the batch with e1 until // sentSecondAndThirdEvents is closed. This way we can add e2 and e3 to the current batch in the meantime. - fakeHandler.HandleEventBatchCalls(func(ctx context.Context, batch events.EventBatch) { + fakeHandler.HandleEventBatchCalls(func(ctx context.Context, logger logr.Logger, batch events.EventBatch) { close(firstHandleEventBatchCallInProgress) <-sentSecondAndThirdEvents }) @@ -106,14 +107,14 @@ var _ = Describe("EventLoop", func() { close(sentSecondAndThirdEvents) Eventually(fakeHandler.HandleEventBatchCallCount).Should(Equal(3)) - _, batch := fakeHandler.HandleEventBatchArgsForCall(1) + _, _, batch := fakeHandler.HandleEventBatchArgsForCall(1) var expectedBatch events.EventBatch = []interface{}{e1} // the first HandleEventBatch() call must have handled a batch with e1 Expect(batch).Should(Equal(expectedBatch)) - _, batch = fakeHandler.HandleEventBatchArgsForCall(2) + _, _, batch = fakeHandler.HandleEventBatchArgsForCall(2) expectedBatch = []interface{}{e2, e3} // the second HandleEventBatch() call must have handled a batch with e2 and e3 diff --git a/internal/mode/provisioner/handler.go b/internal/mode/provisioner/handler.go index 14d3cdd77d..0495e176a7 100644 --- a/internal/mode/provisioner/handler.go +++ b/internal/mode/provisioner/handler.go @@ -27,7 +27,6 @@ type eventHandler struct { statusUpdater status.Updater k8sClient client.Client - logger logr.Logger staticModeDeploymentYAML []byte @@ -38,7 +37,6 @@ func newEventHandler( gcName string, statusUpdater status.Updater, k8sClient client.Client, - logger logr.Logger, staticModeDeploymentYAML []byte, ) *eventHandler { return &eventHandler{ @@ -47,7 +45,6 @@ func newEventHandler( statusUpdater: statusUpdater, gcName: gcName, k8sClient: k8sClient, - logger: logger, staticModeDeploymentYAML: staticModeDeploymentYAML, gatewayNextID: 1, } @@ -80,7 +77,7 @@ func (h *eventHandler) setGatewayClassStatuses(ctx context.Context) { h.statusUpdater.Update(ctx, statuses) } -func (h *eventHandler) ensureDeploymentsMatchGateways(ctx context.Context) { +func (h *eventHandler) ensureDeploymentsMatchGateways(ctx context.Context, logger logr.Logger) { var gwsWithoutDeps, removedGwsWithDeps []types.NamespacedName for nsname, gw := range h.store.gateways { @@ -116,7 +113,7 @@ func (h *eventHandler) ensureDeploymentsMatchGateways(ctx context.Context) { h.provisions[nsname] = deployment - h.logger.Info( + logger.Info( "Created deployment", "deployment", client.ObjectKeyFromObject(deployment), "gateway", nsname, @@ -134,7 +131,7 @@ func (h *eventHandler) ensureDeploymentsMatchGateways(ctx context.Context) { delete(h.provisions, nsname) - h.logger.Info( + logger.Info( "Deleted deployment", "deployment", client.ObjectKeyFromObject(deployment), "gateway", nsname, @@ -142,10 +139,10 @@ func (h *eventHandler) ensureDeploymentsMatchGateways(ctx context.Context) { } } -func (h *eventHandler) HandleEventBatch(ctx context.Context, batch events.EventBatch) { +func (h *eventHandler) HandleEventBatch(ctx context.Context, logger logr.Logger, batch events.EventBatch) { h.store.update(batch) h.setGatewayClassStatuses(ctx) - h.ensureDeploymentsMatchGateways(ctx) + h.ensureDeploymentsMatchGateways(ctx, logger) } func (h *eventHandler) generateDeploymentID() string { diff --git a/internal/mode/provisioner/handler_test.go b/internal/mode/provisioner/handler_test.go index 38d105c438..da61348413 100644 --- a/internal/mode/provisioner/handler_test.go +++ b/internal/mode/provisioner/handler_test.go @@ -96,7 +96,7 @@ var _ = Describe("handler", func() { Resource: gc, }, } - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), zap.New(), batch) // Ensure GatewayClass is accepted @@ -126,7 +126,7 @@ var _ = Describe("handler", func() { }, } - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), zap.New(), batch) depNsName := types.NamespacedName{ Namespace: "nginx-gateway", @@ -156,7 +156,7 @@ var _ = Describe("handler", func() { } handle := func() { - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), zap.New(), batch) } Expect(handle).Should(Panic()) @@ -179,7 +179,6 @@ var _ = Describe("handler", func() { gcName, statusUpdater, k8sclient, - zap.New(), embeddedfiles.StaticModeDeploymentYAML, ) }) @@ -217,7 +216,7 @@ var _ = Describe("handler", func() { }, } - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), zap.New(), batch) deps := &v1.DeploymentList{} err := k8sclient.List(context.Background(), deps) @@ -237,7 +236,7 @@ var _ = Describe("handler", func() { }, } - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), zap.New(), batch) deps := &v1.DeploymentList{} @@ -266,7 +265,7 @@ var _ = Describe("handler", func() { }, } - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), zap.New(), batch) deps := &v1.DeploymentList{} err := k8sclient.List(context.Background(), deps) @@ -295,7 +294,7 @@ var _ = Describe("handler", func() { }, } - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), zap.New(), batch) unknownGC := &v1beta1.GatewayClass{} err = k8sclient.Get(context.Background(), client.ObjectKeyFromObject(gc), unknownGC) @@ -330,7 +329,6 @@ var _ = Describe("handler", func() { gcName, statusUpdater, k8sclient, - zap.New(), embeddedfiles.StaticModeDeploymentYAML, ) }) @@ -340,7 +338,7 @@ var _ = Describe("handler", func() { batch := []interface{}{e} handle := func() { - handler.HandleEventBatch(context.TODO(), batch) + handler.HandleEventBatch(context.Background(), zap.New(), batch) } Expect(handle).Should(Panic()) @@ -408,7 +406,7 @@ var _ = Describe("handler", func() { } handle := func() { - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), zap.New(), batch) } Expect(handle).Should(Panic()) @@ -429,7 +427,7 @@ var _ = Describe("handler", func() { } handle := func() { - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), zap.New(), batch) } Expect(handle).Should(Panic()) @@ -442,7 +440,6 @@ var _ = Describe("handler", func() { gcName, statusUpdater, k8sclient, - zap.New(), []byte("broken YAML"), ) diff --git a/internal/mode/provisioner/manager.go b/internal/mode/provisioner/manager.go index 2a1b4a09b2..0639a7ec6e 100644 --- a/internal/mode/provisioner/manager.go +++ b/internal/mode/provisioner/manager.go @@ -107,7 +107,6 @@ func StartManager(cfg Config) error { cfg.GatewayClassName, statusUpdater, mgr.GetClient(), - cfg.Logger.WithName("eventHandler"), embeddedfiles.StaticModeDeploymentYAML, ) diff --git a/internal/mode/static/handler.go b/internal/mode/static/handler.go index 520ca5db1d..e99cf2ae15 100644 --- a/internal/mode/static/handler.go +++ b/internal/mode/static/handler.go @@ -52,8 +52,6 @@ type eventHandlerConfig struct { controlConfigNSName types.NamespacedName // metricsCollector collects metrics for this controller. metricsCollector handlerMetricsCollector - // logger is the logger to be used by the EventHandler. - logger logr.Logger // version is the current version number of the nginx config. version int } @@ -74,13 +72,13 @@ func newEventHandlerImpl(cfg eventHandlerConfig) *eventHandlerImpl { } } -func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, batch events.EventBatch) { +func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, logger logr.Logger, batch events.EventBatch) { start := time.Now() - h.cfg.logger.V(1).Info("Started processing event batch") + logger.V(1).Info("Started processing event batch") defer func() { duration := time.Since(start) - h.cfg.logger.V(1).Info( + logger.V(1).Info( "Finished processing event batch", "duration", duration.String(), ) @@ -91,13 +89,13 @@ func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, batch events.Ev switch e := event.(type) { case *events.UpsertEvent: if cfg, ok := e.Resource.(*ngfAPI.NginxGateway); ok { - h.updateControlPlaneAndSetStatus(ctx, cfg) + h.updateControlPlaneAndSetStatus(ctx, logger, cfg) } else { h.cfg.processor.CaptureUpsertChange(e.Resource) } case *events.DeleteEvent: if _, ok := e.Type.(*ngfAPI.NginxGateway); ok { - h.updateControlPlaneAndSetStatus(ctx, nil) + h.updateControlPlaneAndSetStatus(ctx, logger, nil) } else { h.cfg.processor.CaptureDeleteChange(e.Type, e.NamespacedName) } @@ -108,7 +106,7 @@ func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, batch events.Ev changed, graph := h.cfg.processor.Process() if !changed { - h.cfg.logger.Info("Handling events didn't result into NGINX configuration changes") + logger.Info("Handling events didn't result into NGINX configuration changes") if !h.cfg.healthChecker.ready && h.cfg.healthChecker.firstBatchError == nil { h.cfg.healthChecker.setAsReady() } @@ -121,13 +119,13 @@ func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, batch events.Ev ctx, dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.cfg.version), ); err != nil { - h.cfg.logger.Error(err, "Failed to update NGINX configuration") + logger.Error(err, "Failed to update NGINX configuration") nginxReloadRes.error = err if !h.cfg.healthChecker.ready { h.cfg.healthChecker.firstBatchError = err } } else { - h.cfg.logger.Info("NGINX configuration was successfully updated") + logger.Info("NGINX configuration was successfully updated") if !h.cfg.healthChecker.ready { h.cfg.healthChecker.setAsReady() } @@ -152,17 +150,21 @@ func (h *eventHandlerImpl) updateNginx(ctx context.Context, conf dataplane.Confi // updateControlPlaneAndSetStatus updates the control plane configuration and then sets the status // based on the outcome -func (h *eventHandlerImpl) updateControlPlaneAndSetStatus(ctx context.Context, cfg *ngfAPI.NginxGateway) { +func (h *eventHandlerImpl) updateControlPlaneAndSetStatus( + ctx context.Context, + logger logr.Logger, + cfg *ngfAPI.NginxGateway, +) { var cond []conditions.Condition if err := updateControlPlane( cfg, - h.cfg.logger, + logger, h.cfg.eventRecorder, h.cfg.controlConfigNSName, h.cfg.logLevelSetter, ); err != nil { msg := "Failed to update control plane configuration" - h.cfg.logger.Error(err, msg) + logger.Error(err, msg) h.cfg.eventRecorder.Eventf( cfg, apiv1.EventTypeWarning, @@ -183,6 +185,6 @@ func (h *eventHandlerImpl) updateControlPlaneAndSetStatus(ctx context.Context, c } h.cfg.statusUpdater.Update(ctx, nginxGatewayStatus) - h.cfg.logger.Info("Reconfigured control plane.") + logger.Info("Reconfigured control plane.") } } diff --git a/internal/mode/static/handler_test.go b/internal/mode/static/handler_test.go index 776e13633f..94aad2fb40 100644 --- a/internal/mode/static/handler_test.go +++ b/internal/mode/static/handler_test.go @@ -69,7 +69,6 @@ var _ = Describe("eventHandler", func() { handler = newEventHandlerImpl(eventHandlerConfig{ processor: fakeProcessor, generator: fakeGenerator, - logger: ctlrZap.New(), logLevelSetter: newZapLogLevelSetter(zap.NewAtomicLevel()), nginxFileMgr: fakeNginxFileMgr, nginxRuntimeMgr: fakeNginxRuntimeMgr, @@ -117,7 +116,7 @@ var _ = Describe("eventHandler", func() { e := &events.UpsertEvent{Resource: &v1beta1.HTTPRoute{}} batch := []interface{}{e} - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) checkUpsertEventExpectations(e) expectReconfig(dataplane.Configuration{Version: 1}, fakeCfgFiles) @@ -130,7 +129,7 @@ var _ = Describe("eventHandler", func() { } batch := []interface{}{e} - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) checkDeleteEventExpectations(e) expectReconfig(dataplane.Configuration{Version: 1}, fakeCfgFiles) @@ -146,12 +145,12 @@ var _ = Describe("eventHandler", func() { } batch := []interface{}{upsertEvent, deleteEvent} - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) checkUpsertEventExpectations(upsertEvent) checkDeleteEventExpectations(deleteEvent) - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) }) }) }) @@ -184,7 +183,7 @@ var _ = Describe("eventHandler", func() { It("handles a valid config", func() { batch := []interface{}{&events.UpsertEvent{Resource: cfg(ngfAPI.ControllerLogLevelError)}} - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) Expect(fakeStatusUpdater.UpdateCallCount()).Should(Equal(1)) _, statuses := fakeStatusUpdater.UpdateArgsForCall(0) @@ -195,7 +194,7 @@ var _ = Describe("eventHandler", func() { It("handles an invalid config", func() { batch := []interface{}{&events.UpsertEvent{Resource: cfg(ngfAPI.ControllerLogLevel("invalid"))}} - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) Expect(fakeStatusUpdater.UpdateCallCount()).Should(Equal(1)) _, statuses := fakeStatusUpdater.UpdateArgsForCall(0) @@ -214,7 +213,7 @@ var _ = Describe("eventHandler", func() { It("handles a deleted config", func() { batch := []interface{}{&events.DeleteEvent{Type: &ngfAPI.NginxGateway{}}} - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) Expect(len(fakeEventRecorder.Events)).To(Equal(1)) event := <-fakeEventRecorder.Events Expect(event).To(Equal("Warning ResourceDeleted NginxGateway configuration was deleted; using defaults")) @@ -229,7 +228,7 @@ var _ = Describe("eventHandler", func() { fakeProcessor.ProcessReturns(true, &graph.Graph{}) Expect(handler.cfg.healthChecker.readyCheck(nil)).ToNot(Succeed()) - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) Expect(handler.cfg.healthChecker.readyCheck(nil)).To(Succeed()) }) @@ -238,7 +237,7 @@ var _ = Describe("eventHandler", func() { batch := []interface{}{e} Expect(handler.cfg.healthChecker.readyCheck(nil)).ToNot(Succeed()) - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) Expect(handler.cfg.healthChecker.readyCheck(nil)).To(Succeed()) }) @@ -249,14 +248,14 @@ var _ = Describe("eventHandler", func() { fakeProcessor.ProcessReturns(true, &graph.Graph{}) fakeNginxRuntimeMgr.ReloadReturns(errors.New("reload error")) - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) Expect(handler.cfg.healthChecker.readyCheck(nil)).ToNot(Succeed()) // now send an update with no changes; should still return an error fakeProcessor.ProcessReturns(false, &graph.Graph{}) - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) Expect(handler.cfg.healthChecker.readyCheck(nil)).ToNot(Succeed()) @@ -264,7 +263,7 @@ var _ = Describe("eventHandler", func() { fakeProcessor.ProcessReturns(true, &graph.Graph{}) fakeNginxRuntimeMgr.ReloadReturns(nil) - handler.HandleEventBatch(context.Background(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) Expect(handler.cfg.healthChecker.readyCheck(nil)).To(Succeed()) }) @@ -274,7 +273,7 @@ var _ = Describe("eventHandler", func() { handle := func() { batch := []interface{}{e} - handler.HandleEventBatch(context.TODO(), batch) + handler.HandleEventBatch(context.Background(), ctlrZap.New(), batch) } Expect(handle).Should(Panic()) diff --git a/internal/mode/static/manager.go b/internal/mode/static/manager.go index df7f5ab4b6..90ec48275b 100644 --- a/internal/mode/static/manager.go +++ b/internal/mode/static/manager.go @@ -168,7 +168,6 @@ func StartManager(cfg config.Config) error { processor: processor, serviceResolver: resolver.NewServiceResolverImpl(mgr.GetClient()), generator: ngxcfg.NewGeneratorImpl(), - logger: cfg.Logger.WithName("eventHandler"), logLevelSetter: logLevelSetter, nginxFileMgr: file.NewManagerImpl( cfg.Logger.WithName("nginxFileManager"),