Skip to content

Commit

Permalink
PB-7579: Creation of webhook controller in runtime should be only if …
Browse files Browse the repository at this point in the history
…stork is running with a driver. (#1813)
  • Loading branch information
diptiranjanpx committed Jul 12, 2024
1 parent b48947b commit 87526ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/stork/stork.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,12 +588,12 @@ func runStork(mgr manager.Manager, ctx context.Context, d volume.Driver, recorde
log.Fatalf("Error initializing cluster domain controllers: %v", err)
}
}
}

if c.Bool("webhook-controller") {
log.Infof("Creating mutating webhook after leader election")
if err := webhookadmission.CreateMutateWebhookRuntime(); err != nil {
log.Fatalf("Error creating webhook: %v", err)
if c.Bool("webhook-controller") {
log.Infof("Creating mutating webhook after leader election")
if err := webhookadmission.CreateMutateWebhookRuntime(); err != nil {
log.Fatalf("Error creating webhook: %v", err)
}
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/webhookadmission/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ func createWebhookV1(caBundle []byte, ns string) error {
if err != nil {
log.Errorf("Unable to create webhook configuration: %v", err)
}
log.Debugf("Stork webhook v1 created: %v", webhookName)
}
return err
}
Expand Down
1 change: 1 addition & 0 deletions pkg/webhookadmission/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ func (c *Controller) Stop() error {
log.Errorf("unable to delete webhook configuration, %v", err)
return err
}
log.Infof("Successfully deleted webhook configuration %s", storkAdmissionController)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

Expand Down

0 comments on commit 87526ca

Please sign in to comment.