Skip to content

Commit

Permalink
Watch for specific set of namespaces using the client
Browse files Browse the repository at this point in the history
Multiple storagecluster requires client to watch multiple namespaces

Signed-off-by: Nitin Goyal <[email protected]>
  • Loading branch information
iamniting committed Nov 30, 2023
1 parent 23a2f28 commit 82cc119
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ func main() {
os.Exit(1)
}

defaultNamespaces := map[string]cache.Config{
operatorNamespace: {},
"openshift-storage-extended": {},
}

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Expand All @@ -103,7 +108,7 @@ func main() {
LeaderElection: enableLeaderElection,
LeaderElectionID: "4fd470de.openshift.io",
LeaderElectionNamespace: operatorNamespace,
Cache: cache.Options{DefaultNamespaces: map[string]cache.Config{operatorNamespace: {}}},
Cache: cache.Options{DefaultNamespaces: defaultNamespaces},
})
if err != nil {
setupLog.Error(err, "unable to start manager")
Expand Down

0 comments on commit 82cc119

Please sign in to comment.