Skip to content

Commit

Permalink
Merge pull request #40 from enxebre/namespace-resync
Browse files Browse the repository at this point in the history
Namespace and resync
  • Loading branch information
enxebre authored May 15, 2019
2 parents 261136c + 95b91c5 commit 9941763
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main
import (
"flag"
"log"
"time"

"github.com/openshift/cluster-api/pkg/apis"
"github.com/openshift/cluster-api/pkg/controller"
Expand All @@ -32,16 +33,26 @@ 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 {
log.Fatal(err)
}

// Create a new Cmd to provide shared dependencies and start components
mgr, err := manager.New(cfg, manager.Options{})
syncPeriod := 10 * time.Minute
mgr, err := manager.New(cfg, manager.Options{
SyncPeriod: &syncPeriod,
Namespace: *watchNamespace,
})
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 9941763

Please sign in to comment.