4
4
package v1
5
5
6
6
import (
7
+ "context"
7
8
"encoding/json"
8
9
"errors"
9
10
"fmt"
@@ -34,10 +35,10 @@ func (r *Policy) SetupWebhookWithManager(mgr ctrl.Manager) error {
34
35
35
36
//+kubebuilder:webhook:path=/validate-policy-open-cluster-management-io-v1-policy,mutating=false,failurePolicy=Ignore,sideEffects=None,groups=policy.open-cluster-management.io,resources=policies,verbs=create,versions=v1,name=policy.open-cluster-management.io.webhook,admissionReviewVersions=v1
36
37
37
- var _ webhook.Validator = & Policy {}
38
+ var _ webhook.CustomValidator = & Policy {}
38
39
39
- // ValidateCreate implements webhook.Validator so a webhook will be registered for the type
40
- func (r * Policy ) ValidateCreate () (admission.Warnings , error ) {
40
+ // ValidateCreate implements webhook.CustomValidator so a webhook will be registered for the type
41
+ func (r * Policy ) ValidateCreate (_ context. Context , _ runtime. Object ) (admission.Warnings , error ) {
41
42
log := policylog .WithValues ("policyName" , r .Name , "policyNamespace" , r .Namespace )
42
43
log .V (1 ).Info ("Validate policy creation request" )
43
44
@@ -54,8 +55,8 @@ func (r *Policy) ValidateCreate() (admission.Warnings, error) {
54
55
return nil , nil
55
56
}
56
57
57
- // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
58
- func (r * Policy ) ValidateUpdate (_ runtime.Object ) (admission.Warnings , error ) {
58
+ // ValidateUpdate implements webhook.CustomValidator so a webhook will be registered for the type
59
+ func (r * Policy ) ValidateUpdate (_ context. Context , _ , _ runtime.Object ) (admission.Warnings , error ) {
59
60
log := policylog .WithValues ("policyName" , r .Name , "policyNamespace" , r .Namespace )
60
61
log .V (1 ).Info ("Validate policy update request" )
61
62
@@ -67,8 +68,8 @@ func (r *Policy) ValidateUpdate(_ runtime.Object) (admission.Warnings, error) {
67
68
return nil , nil
68
69
}
69
70
70
- // ValidateDelete implements webhook.Validator so a webhook will be registered for the type
71
- func (r * Policy ) ValidateDelete () (admission.Warnings , error ) {
71
+ // ValidateDelete implements webhook.CustomValidator so a webhook will be registered for the type
72
+ func (r * Policy ) ValidateDelete (_ context. Context , obj runtime. Object ) (admission.Warnings , error ) {
72
73
return nil , nil
73
74
}
74
75
0 commit comments