Skip to content

Commit

Permalink
Set RecoverPanic to true for webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
shafeeqes committed Sep 13, 2022
1 parent e0351eb commit ad6e673
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion extensions/pkg/webhook/cloudprovider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func New(mgr manager.Manager, args Args) (*extensionswebhook.Webhook, error) {
Target: extensionswebhook.TargetSeed,
Provider: args.Provider,
Types: types,
Webhook: &admission.Webhook{Handler: handler},
Webhook: &admission.Webhook{Handler: handler, RecoverPanic: true},
Path: WebhookName,
Selector: namespaceSelector,
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/pkg/webhook/controlplane/controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func New(mgr manager.Manager, args Args) (*extensionswebhook.Webhook, error) {
Types: args.Types,
Target: extensionswebhook.TargetSeed,
Path: getName(args.Kind),
Webhook: &admission.Webhook{Handler: handler},
Webhook: &admission.Webhook{Handler: handler, RecoverPanic: true},
Selector: namespaceSelector,
}, nil
}
Expand Down
1 change: 1 addition & 0 deletions extensions/pkg/webhook/handler_shootclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func NewHandlerWithShootClient(mgr manager.Manager, types []Type, mutator Mutato
mutator: mutator,
logger: logger.WithName("handlerShootClient"),
},
RecoverPanic: true,
},
}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/pkg/webhook/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func New(mgr manager.Manager, args Args) (*webhook.Webhook, error) {
Types: args.Types,
Target: extensionswebhook.TargetSeed,
Path: path,
Webhook: &admission.Webhook{Handler: handler},
Webhook: &admission.Webhook{Handler: handler, RecoverPanic: true},
Selector: namespaceSelector,
}, nil

Expand Down
2 changes: 1 addition & 1 deletion extensions/pkg/webhook/shoot/shoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func New(mgr manager.Manager, args Args) (*extensionswebhook.Webhook, error) {
return nil, err
}

wh.Webhook = &admission.Webhook{Handler: handler}
wh.Webhook = &admission.Webhook{Handler: handler, RecoverPanic: true}
return wh, nil

case args.MutatorWithShootClient != nil:
Expand Down
2 changes: 1 addition & 1 deletion extensions/pkg/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ func New(mgr manager.Manager, args Args) (*Webhook, error) {

return &Webhook{
Path: args.Path,
Webhook: &admission.Webhook{Handler: handler},
Webhook: &admission.Webhook{Handler: handler, RecoverPanic: true},
}, nil
}
2 changes: 1 addition & 1 deletion pkg/provider-local/webhook/dnsconfig/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func AddToManagerWithOptions(mgr manager.Manager, _ AddOptions) (*extensionswebh
Types: types,
Target: extensionswebhook.TargetSeed,
Path: name,
Webhook: &admission.Webhook{Handler: handler},
Webhook: &admission.Webhook{Handler: handler, RecoverPanic: true},
ObjectSelector: &metav1.LabelSelector{MatchExpressions: []metav1.LabelSelectorRequirement{
{Key: "app", Operator: metav1.LabelSelectorOpIn, Values: []string{
"machine",
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider-local/webhook/node/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func AddToManagerWithOptions(
Types: types,
Target: target,
Path: name,
Webhook: &admission.Webhook{Handler: handler},
Webhook: &admission.Webhook{Handler: handler, RecoverPanic: true},
FailurePolicy: &failurePolicy,
TimeoutSeconds: pointer.Int32(5),
}, nil
Expand Down

0 comments on commit ad6e673

Please sign in to comment.