Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
moved controller runtime start out of webhook Run function
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw committed Mar 28, 2023
1 parent b1e5482 commit 775c4e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions cmd/controller/cmd/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ func runWebhook(origContext context.Context, propellerCfg *config.Config, cfg *w
return err
})

g.Go(func() error {
err := controller.StartControllerManager(childCtx, mgr)
if err != nil {
logger.Fatalf(childCtx, "Failed to start controller manager. Error: %v", err)
}
return err
})

g.Go(func() error {
err := webhook.Run(childCtx, propellerCfg, cfg, defaultNamespace, &webhookScope, mgr)
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions pkg/webhook/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ func Run(ctx context.Context, propellerCfg *config.Config, cfg *config2.Config,
logger.Fatalf(ctx, "Failed to register webhook with manager. Error: %v", err)
}

logger.Infof(ctx, "Starting controller-runtime manager")
return (*mgr).Start(ctx)
logger.Infof(ctx, "Started propeller webhook")
<-ctx.Done()

return nil
}

func createMutationConfig(ctx context.Context, kubeClient *kubernetes.Clientset, webhookObj *PodMutator, defaultNamespace string) error {
Expand Down

0 comments on commit 775c4e7

Please sign in to comment.