|
71 | 71 | leaderElectionRenewDeadline time.Duration
|
72 | 72 | leaderElectionRetryPeriod time.Duration
|
73 | 73 | watchFilterValue string
|
74 |
| - watchNamespace string |
| 74 | + watchNamespacesList []string |
75 | 75 | profilerAddress string
|
76 | 76 | enableContentionProfiling bool
|
77 | 77 | syncPeriod time.Duration
|
@@ -118,8 +118,8 @@ func InitFlags(fs *pflag.FlagSet) {
|
118 | 118 | fs.DurationVar(&leaderElectionRetryPeriod, "leader-elect-retry-period", 2*time.Second,
|
119 | 119 | "Duration the LeaderElector clients should wait between tries of actions (duration string)")
|
120 | 120 |
|
121 |
| - fs.StringVar(&watchNamespace, "namespace", "", |
122 |
| - "Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces.") |
| 121 | + fs.StringSliceVar(&watchNamespacesList, "namespace", nil, |
| 122 | + "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.") |
123 | 123 |
|
124 | 124 | fs.StringVar(&watchFilterValue, "watch-filter", "",
|
125 | 125 | 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))
|
@@ -214,9 +214,10 @@ func main() {
|
214 | 214 | }
|
215 | 215 |
|
216 | 216 | var watchNamespaces map[string]cache.Config
|
217 |
| - if watchNamespace != "" { |
218 |
| - watchNamespaces = map[string]cache.Config{ |
219 |
| - watchNamespace: {}, |
| 217 | + if watchNamespacesList != nil { |
| 218 | + watchNamespaces = map[string]cache.Config{} |
| 219 | + for _, watchNamespace := range watchNamespacesList { |
| 220 | + watchNamespaces[watchNamespace] = cache.Config{} |
220 | 221 | }
|
221 | 222 | }
|
222 | 223 |
|
|
0 commit comments