diff --git a/cmd/manager/main.go b/cmd/manager/main.go index e46e7cbde132..f10eb99060b0 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -33,8 +33,14 @@ import ( func main() { flag.Set("logtostderr", "true") klog.InitFlags(nil) - flag.Parse() + watchNamespace := flag.String("namespace", "", + "Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces.") + flag.Parse() + if *watchNamespace != "" { + log.Printf("Watching cluster-api objects only in namespace %q for reconciliation.", *watchNamespace) + } + log.Printf("Registering Components.") // Get a config to talk to the apiserver cfg, err := config.GetConfig() if err != nil { @@ -45,6 +51,7 @@ func main() { syncPeriod := 10 * time.Minute mgr, err := manager.New(cfg, manager.Options{ SyncPeriod: &syncPeriod, + Namespace: *watchNamespace, }) if err != nil { log.Fatal(err)