Checks error for loading audit webhook config to prevent panic

Signed-off-by: JoshVanL <vleeuwenjoshua@gmail.com>
This commit is contained in:
JoshVanL 2020-03-05 23:30:50 +00:00
parent 8508875e4d
commit 1bb6ed9bdc
No known key found for this signature in database
GPG Key ID: E7A7196576A219DA

View File

@ -64,8 +64,12 @@ func retryOnError(err error) bool {
func loadWebhook(configFile string, groupVersion schema.GroupVersion, initialBackoff time.Duration, customDial utilnet.DialFunc) (*webhook.GenericWebhook, error) {
w, err := webhook.NewGenericWebhook(audit.Scheme, audit.Codecs, configFile,
[]schema.GroupVersion{groupVersion}, initialBackoff, customDial)
if err != nil {
return nil, err
}
w.ShouldRetry = retryOnError
return w, err
return w, nil
}
type backend struct {