Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
[Fix/Operator] Change namespace watch configuration to manage single …
Browse files Browse the repository at this point in the history
…namespace deletion (#109)

* change namespace watch configuration to manage single namespace deletion

* append changelog
  • Loading branch information
erdrix authored Jun 9, 2021
1 parent 82df9b6 commit da95959
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit da95959

Please sign in to comment.