@@ -29,9 +29,9 @@ import (
29
29
30
30
// CustomValidatorWarn works like CustomValidator, but it allows to return warnings.
31
31
type CustomValidatorWarn interface {
32
- ValidateCreate (ctx context.Context , obj runtime.Object ) (err error , warnings []string )
33
- ValidateUpdate (ctx context.Context , oldObj , newObj runtime.Object ) (err error , warnings []string )
34
- ValidateDelete (ctx context.Context , obj runtime.Object ) (err error , warnings []string )
32
+ ValidateCreate (ctx context.Context , obj runtime.Object ) (warnings []string , err error )
33
+ ValidateUpdate (ctx context.Context , oldObj , newObj runtime.Object ) (warnings []string , err error )
34
+ ValidateDelete (ctx context.Context , obj runtime.Object ) (warnings []string , err error )
35
35
}
36
36
37
37
// WithCustomValidatorWarn creates a new Webhook for validating the provided type.
@@ -75,7 +75,7 @@ func (h *validatorWarnForType) Handle(ctx context.Context, req Request) Response
75
75
return Errored (http .StatusBadRequest , err )
76
76
}
77
77
78
- err , warnings = h .validatorWarn .ValidateCreate (ctx , obj )
78
+ warnings , err = h .validatorWarn .ValidateCreate (ctx , obj )
79
79
case v1 .Update :
80
80
oldObj := obj .DeepCopyObject ()
81
81
if err := h .decoder .DecodeRaw (req .Object , obj ); err != nil {
@@ -85,15 +85,15 @@ func (h *validatorWarnForType) Handle(ctx context.Context, req Request) Response
85
85
return Errored (http .StatusBadRequest , err )
86
86
}
87
87
88
- err , warnings = h .validatorWarn .ValidateUpdate (ctx , oldObj , obj )
88
+ warnings , err = h .validatorWarn .ValidateUpdate (ctx , oldObj , obj )
89
89
case v1 .Delete :
90
90
// In reference to PR: https://github.com/kubernetes/kubernetes/pull/76346
91
91
// OldObject contains the object being deleted
92
92
if err := h .decoder .DecodeRaw (req .OldObject , obj ); err != nil {
93
93
return Errored (http .StatusBadRequest , err )
94
94
}
95
95
96
- err , warnings = h .validatorWarn .ValidateDelete (ctx , obj )
96
+ warnings , err = h .validatorWarn .ValidateDelete (ctx , obj )
97
97
default :
98
98
return Errored (http .StatusBadRequest , fmt .Errorf ("unknown operation request %q" , req .Operation ))
99
99
}
0 commit comments