|
69 | 69 | leaderElectionRenewDeadline time.Duration
|
70 | 70 | leaderElectionRetryPeriod time.Duration
|
71 | 71 | watchFilterValue string
|
72 |
| - watchNamespace string |
| 72 | + watchNamespacesList []string |
73 | 73 | profilerAddress string
|
74 | 74 | enableContentionProfiling bool
|
75 | 75 | syncPeriod time.Duration
|
@@ -116,8 +116,8 @@ func InitFlags(fs *pflag.FlagSet) {
|
116 | 116 | fs.DurationVar(&leaderElectionRetryPeriod, "leader-elect-retry-period", 2*time.Second,
|
117 | 117 | "Duration the LeaderElector clients should wait between tries of actions (duration string)")
|
118 | 118 |
|
119 |
| - fs.StringVar(&watchNamespace, "namespace", "", |
120 |
| - "Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces.") |
| 119 | + fs.StringSliceVar(&watchNamespacesList, "namespace", nil, |
| 120 | + "Comma-separated list of namespaces that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces.") |
121 | 121 |
|
122 | 122 | fs.StringVar(&watchFilterValue, "watch-filter", "",
|
123 | 123 | fmt.Sprintf("Label value that the controller watches to reconcile cluster-api objects. Label key is always %s. If unspecified, the controller watches for all cluster-api objects.", clusterv1.WatchLabel))
|
@@ -212,9 +212,10 @@ func main() {
|
212 | 212 | }
|
213 | 213 |
|
214 | 214 | var watchNamespaces map[string]cache.Config
|
215 |
| - if watchNamespace != "" { |
216 |
| - watchNamespaces = map[string]cache.Config{ |
217 |
| - watchNamespace: {}, |
| 215 | + if watchNamespacesList != nil { |
| 216 | + watchNamespaces = map[string]cache.Config{} |
| 217 | + for _, watchNamespace := range watchNamespacesList { |
| 218 | + watchNamespaces[watchNamespace] = cache.Config{} |
218 | 219 | }
|
219 | 220 | }
|
220 | 221 |
|
|
0 commit comments