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

Moved controller-runtime start out of webhook Run function #546

Merged
merged 2 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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