Skip to content

Commit

Permalink
moved controller runtime start out of webhook Run function (flyteorg#546
Browse files Browse the repository at this point in the history
)

Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw authored Apr 7, 2023
1 parent 6af4de2 commit 986f014
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 986f014

Please sign in to comment.