From 0719d35ee9f7fb6850ec99f34bed69c4ea183322 Mon Sep 17 00:00:00 2001 From: William Dumont Date: Tue, 10 Oct 2023 16:07:43 +0200 Subject: [PATCH] set value in map only if namespace is not empty --- component/loki/source/kubernetes_events/event_controller.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/component/loki/source/kubernetes_events/event_controller.go b/component/loki/source/kubernetes_events/event_controller.go index d6ddd8d41833..c161f01a288f 100644 --- a/component/loki/source/kubernetes_events/event_controller.go +++ b/component/loki/source/kubernetes_events/event_controller.go @@ -97,7 +97,9 @@ func (ctrl *eventController) runError(ctx context.Context) error { } defaultNamespaces := map[string]cache.Config{} - defaultNamespaces[ctrl.task.Namespace] = cache.Config{} + if ctrl.task.Namespace != "" { + defaultNamespaces[ctrl.task.Namespace] = cache.Config{} + } opts := cache.Options{ Scheme: scheme, DefaultNamespaces: defaultNamespaces,