Skip to content

Commit

Permalink
Fix: define default namespace cache only if watchNamespace is set (#860)
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas authored Jan 13, 2025
1 parent fdad12d commit 6a09135
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,18 @@ func main() {
WithName("FlinkCluster")
ctrl.SetLogger(logger)

defaultNamespaces := make(map[string]cache.Config)
if *watchNamespace != "" {
setupLog.Info("Watching custom resources in the namespace", "namespace", *watchNamespace)
defaultNamespaces[*watchNamespace] = cache.Config{}
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Metrics: metricsserver.Options{BindAddress: *metricsAddr},
LeaderElection: *enableLeaderElection,
Cache: cache.Options{
DefaultNamespaces: map[string]cache.Config{*watchNamespace: {}},
DefaultNamespaces: defaultNamespaces,
},
LeaderElectionID: *leaderElectionID,
})
Expand Down

0 comments on commit 6a09135

Please sign in to comment.