Checks error for loading audit webhook config to prevent panic
Signed-off-by: JoshVanL <vleeuwenjoshua@gmail.com> Kubernetes-commit: 1bb6ed9bdc0fb960d0acedc575a59de1306006ca
This commit is contained in:
parent
ea2fe0c9c4
commit
f93ee6dd2e
|
|
@ -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) {
|
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,
|
w, err := webhook.NewGenericWebhook(audit.Scheme, audit.Codecs, configFile,
|
||||||
[]schema.GroupVersion{groupVersion}, initialBackoff, customDial)
|
[]schema.GroupVersion{groupVersion}, initialBackoff, customDial)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
w.ShouldRetry = retryOnError
|
w.ShouldRetry = retryOnError
|
||||||
return w, err
|
return w, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type backend struct {
|
type backend struct {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue