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

Commit 986f014

Browse files
authored
moved controller runtime start out of webhook Run function (#546)
Signed-off-by: Daniel Rammer <[email protected]>
1 parent 6af4de2 commit 986f014

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

cmd/controller/cmd/webhook.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ func runWebhook(origContext context.Context, propellerCfg *config.Config, cfg *w
130130
return err
131131
})
132132

133+
g.Go(func() error {
134+
err := controller.StartControllerManager(childCtx, mgr)
135+
if err != nil {
136+
logger.Fatalf(childCtx, "Failed to start controller manager. Error: %v", err)
137+
}
138+
return err
139+
})
140+
133141
g.Go(func() error {
134142
err := webhook.Run(childCtx, propellerCfg, cfg, defaultNamespace, &webhookScope, mgr)
135143
if err != nil {

pkg/webhook/entrypoint.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ func Run(ctx context.Context, propellerCfg *config.Config, cfg *config2.Config,
5252
logger.Fatalf(ctx, "Failed to register webhook with manager. Error: %v", err)
5353
}
5454

55-
logger.Infof(ctx, "Starting controller-runtime manager")
56-
return (*mgr).Start(ctx)
55+
logger.Infof(ctx, "Started propeller webhook")
56+
<-ctx.Done()
57+
58+
return nil
5759
}
5860

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

0 commit comments

Comments
 (0)