From 76d83ae01aee37ec538731e60c6739db95b1e13c Mon Sep 17 00:00:00 2001 From: Uburro Date: Mon, 10 Feb 2025 16:54:58 +0100 Subject: [PATCH] delete unsued watch ns --- .../clustercontroller/watch_namespaces.go | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 internal/controller/clustercontroller/watch_namespaces.go diff --git a/internal/controller/clustercontroller/watch_namespaces.go b/internal/controller/clustercontroller/watch_namespaces.go deleted file mode 100644 index 2df0f442..00000000 --- a/internal/controller/clustercontroller/watch_namespaces.go +++ /dev/null @@ -1,29 +0,0 @@ -package clustercontroller - -import ( - "slices" - "strings" -) - -type WatchNamespaces []string - -func NewWatchNamespaces(env string) WatchNamespaces { - namespacesFromEnv := strings.Split(env, ",") - var watchNamespaces []string - for _, ns := range namespacesFromEnv { - ns = strings.TrimSpace(ns) - if len(ns) > 0 { - watchNamespaces = append(watchNamespaces, ns) - } - } - return watchNamespaces -} - -const allNamespaces = "*" - -func (wn WatchNamespaces) IsWatched(namespace string) bool { - if len(wn) == 0 || slices.Contains(wn, allNamespaces) { - return true - } - return slices.Contains(wn, namespace) -}