Skip to content

Commit 87526ca

Browse files
committed
PB-7579: Creation of webhook controller in runtime should be only if stork is running with a driver. (#1813)
1 parent b48947b commit 87526ca

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

cmd/stork/stork.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,12 @@ func runStork(mgr manager.Manager, ctx context.Context, d volume.Driver, recorde
588588
log.Fatalf("Error initializing cluster domain controllers: %v", err)
589589
}
590590
}
591-
}
592591

593-
if c.Bool("webhook-controller") {
594-
log.Infof("Creating mutating webhook after leader election")
595-
if err := webhookadmission.CreateMutateWebhookRuntime(); err != nil {
596-
log.Fatalf("Error creating webhook: %v", err)
592+
if c.Bool("webhook-controller") {
593+
log.Infof("Creating mutating webhook after leader election")
594+
if err := webhookadmission.CreateMutateWebhookRuntime(); err != nil {
595+
log.Fatalf("Error creating webhook: %v", err)
596+
}
597597
}
598598
}
599599

pkg/webhookadmission/utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ func createWebhookV1(caBundle []byte, ns string) error {
234234
if err != nil {
235235
log.Errorf("Unable to create webhook configuration: %v", err)
236236
}
237+
log.Debugf("Stork webhook v1 created: %v", webhookName)
237238
}
238239
return err
239240
}

pkg/webhookadmission/webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ func (c *Controller) Stop() error {
279279
log.Errorf("unable to delete webhook configuration, %v", err)
280280
return err
281281
}
282+
log.Infof("Successfully deleted webhook configuration %s", storkAdmissionController)
282283
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
283284
defer cancel()
284285

0 commit comments

Comments
 (0)