Skip to content

Commit

Permalink
UPSTREAM: <carry>: openshift: Add namespace flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ingvagabund authored and openshift-merge-robot committed Jun 12, 2019
1 parent 0f6d8d2 commit c0d3008
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,23 @@ import (
)

func main() {
watchNamespace := flag.String("namespace", "", "Namespace that the controller watches to reconcile machine-api objects. If unspecified, the controller watches for machine-api objects across all namespaces.")

klog.InitFlags(nil)
flag.Set("logtostderr", "true")
flag.Parse()

cfg := config.GetConfigOrDie()

opts := manager.Options{}

if *watchNamespace != "" {
opts.Namespace = *watchNamespace
klog.Infof("Watching machine-api objects only in namespace %q for reconciliation.", opts.Namespace)
}

// Setup a Manager
mgr, err := manager.New(cfg, manager.Options{})
mgr, err := manager.New(cfg, opts)
if err != nil {
klog.Fatalf("Failed to set up overall controller manager: %v", err)
}
Expand Down

0 comments on commit c0d3008

Please sign in to comment.