Skip to content

Commit

Permalink
remove goroutine in sharedmain to start informer
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Lin committed Sep 29, 2020
1 parent 99f7df5 commit 89b56be
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions injection/sharedmain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,9 @@ func MainWithConfig(ctx context.Context, component string, cfg *rest.Config, cto

// Start the injection clients and informers.
logging.FromContext(ctx).Info("Starting informers...")
go func(ctx context.Context) {
if err := controller.StartInformers(ctx.Done(), informers...); err != nil {
logging.FromContext(ctx).Fatalw("Failed to start informers", zap.Error(err))
}
<-ctx.Done()
}(ctx)
if err := controller.StartInformers(ctx.Done(), informers...); err != nil {
logging.FromContext(ctx).Fatalw("Failed to start informers", zap.Error(err))
}
// Wait for webhook informers to sync.
if wh != nil {
wh.InformersHaveSynced()
Expand Down

0 comments on commit 89b56be

Please sign in to comment.