Skip to content

Commit 381a372

Browse files
authored
Merge pull request kubernetes#88879 from JoshVanL/88878-apiserver-webhook-config-panic
Checks error for loading audit webhook config to prevent panic
2 parents 5383e01 + 1bb6ed9 commit 381a372

File tree

1 file changed

+5
-1
lines changed
  • staging/src/k8s.io/apiserver/plugin/pkg/audit/webhook

1 file changed

+5
-1
lines changed

staging/src/k8s.io/apiserver/plugin/pkg/audit/webhook/webhook.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,12 @@ func retryOnError(err error) bool {
6464
func loadWebhook(configFile string, groupVersion schema.GroupVersion, initialBackoff time.Duration, customDial utilnet.DialFunc) (*webhook.GenericWebhook, error) {
6565
w, err := webhook.NewGenericWebhook(audit.Scheme, audit.Codecs, configFile,
6666
[]schema.GroupVersion{groupVersion}, initialBackoff, customDial)
67+
if err != nil {
68+
return nil, err
69+
}
70+
6771
w.ShouldRetry = retryOnError
68-
return w, err
72+
return w, nil
6973
}
7074

7175
type backend struct {

0 commit comments

Comments
 (0)