Skip to content

Commit

Permalink
start manager
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Sloka <slokas@vmware.com>
  • Loading branch information
stevesloka committed May 7, 2021
1 parent e3a073b commit 8008743
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/contour/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"syscall"
"time"

"sigs.k8s.io/controller-runtime/pkg/manager/signals"

envoy_server_v3 "github.com/envoyproxy/go-control-plane/pkg/server/v3"
contour_api_v1 "github.com/projectcontour/contour/apis/projectcontour/v1"
contour_api_v1alpha1 "github.com/projectcontour/contour/apis/projectcontour/v1alpha1"
Expand Down Expand Up @@ -411,6 +413,9 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error {
}
}

// Set up workgroup runner and register informers.
var g workgroup.Group

// Only inform on GatewayAPI resources if Gateway API is found.
if ctx.Config.GatewayConfig != nil {
if clients.ResourcesExist(k8s.GatewayAPIResources()...) {
Expand Down Expand Up @@ -451,6 +456,11 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error {
if err := informOnResource(clients, k8s.NamespacesResource(), &dynamicHandler); err != nil {
log.WithError(err).WithField("resource", k8s.NamespacesResource()).Fatal("failed to create informer")
}

// Start Manager
g.AddContext(func(taskCtx context.Context) error {
return mgr.Start(signals.SetupSignalHandler())
})
} else {
log.Fatalf("GatewayAPI Gateway configured but APIs not installed in cluster.")
}
Expand Down Expand Up @@ -484,9 +494,6 @@ func doServe(log logrus.FieldLogger, ctx *serveContext) error {
}
}

// Set up workgroup runner and register informers.
var g workgroup.Group

// Register a task to start all the informers.
g.AddContext(func(taskCtx context.Context) error {
log := log.WithField("context", "informers")
Expand Down

0 comments on commit 8008743

Please sign in to comment.