@@ -28,10 +28,23 @@ import (
28
28
)
29
29
30
30
// CustomValidator defines functions for validating an operation.
31
+ // The object to be validated is passed into methods as a parameter.
31
32
type CustomValidator interface {
32
- ValidateCreate (ctx context.Context , obj runtime.Object ) ([]string , error )
33
- ValidateUpdate (ctx context.Context , oldObj , newObj runtime.Object ) ([]string , error )
34
- ValidateDelete (ctx context.Context , obj runtime.Object ) ([]string , error )
33
+
34
+ // ValidateCreate validates the object on creation.
35
+ // The optional warnings will be added to the response as warning messages.
36
+ // Return an error if the object is invalid.
37
+ ValidateCreate (ctx context.Context , obj runtime.Object ) (warnings []string , err error )
38
+
39
+ // ValidateUpdate validates the object on update.
40
+ // The optional warnings will be added to the response as warning messages.
41
+ // Return an error if the object is invalid.
42
+ ValidateUpdate (ctx context.Context , oldObj , newObj runtime.Object ) (warnings []string , err error )
43
+
44
+ // ValidateDelete validates the object on deletion.
45
+ // The optional warnings will be added to the response as warning messages.
46
+ // Return an error if the object is invalid.
47
+ ValidateDelete (ctx context.Context , obj runtime.Object ) (warnings []string , err error )
35
48
}
36
49
37
50
// WithCustomValidator creates a new Webhook for validating the provided type.
0 commit comments