From 606f062fa0f096dbd475374ffc322f84b6ba1ecb Mon Sep 17 00:00:00 2001 From: "alexandre.vilain" Date: Wed, 4 Sep 2024 17:14:37 +0200 Subject: [PATCH] fix assignment to entry in nil map when --watch-namespaces flag is provided Signed-off-by: alexandre.vilain --- cmd/fluent-manager/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/fluent-manager/main.go b/cmd/fluent-manager/main.go index 4d43ba231..b8ed7b97d 100644 --- a/cmd/fluent-manager/main.go +++ b/cmd/fluent-manager/main.go @@ -17,12 +17,11 @@ limitations under the License. package main import ( + "errors" "flag" "os" "strings" - "errors" - "github.com/joho/godotenv" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/metrics/server" @@ -105,6 +104,8 @@ func main() { config := cache.Config{} namespacedController = true namespaces := strings.Split(watchNamespaces, ",") + + ctrlOpts.Cache.DefaultNamespaces = make(map[string]cache.Config) for _, namespace := range namespaces { ctrlOpts.Cache.DefaultNamespaces[namespace] = config }