From da95959c3121cee78072f3182c57537a9c462565 Mon Sep 17 00:00:00 2001 From: Alexandre Guitton Date: Wed, 9 Jun 2021 15:19:00 +0200 Subject: [PATCH] [Fix/Operator] Change namespace watch configuration to manage single namespace deletion (#109) * change namespace watch configuration to manage single namespace deletion * append changelog --- CHANGELOG.md | 3 +++ main.go | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86cb4ed81..08ff966cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ ### Fixed Bugs +- [PR #109](https://github.com/Orange-OpenSource/nifikop/pull/109) - **[Operator/NifiCluster]** Change namespace watch configuration to manage single namespace deletion. + + ## v0.6.1 ### Added diff --git a/main.go b/main.go index d93827d67..a85257ee4 100644 --- a/main.go +++ b/main.go @@ -92,16 +92,18 @@ func main() { HealthProbeBindAddress: probeAddr, LeaderElection: enableLeaderElection, LeaderElectionID: "f1c5ece8.example.com", - Namespace: watchNamespace, // namespaced-scope when the value is not an empty string } // Add support for MultiNamespace set in WATCH_NAMESPACE (e.g ns1,ns2) var namespaceList []string - if strings.Contains(watchNamespace, ",") { + if watchNamespace != "" { setupLog.Info("manager set up with multiple namespaces", "namespaces", watchNamespace) namespaceList = strings.Split(watchNamespace, ",") + + for i := range namespaceList { + namespaceList[i] = strings.TrimSpace(namespaceList[i]) + } // configure cluster-scoped with MultiNamespacedCacheBuilder - options.Namespace = "" options.NewCache = cache.MultiNamespacedCacheBuilder(namespaceList) }