@@ -49,10 +49,10 @@ func (r *OpenStackMachineTemplateWebhook) SetupWebhookWithManager(mgr manager.Ma
49
49
var _ webhook.CustomValidator = & OpenStackMachineTemplateWebhook {}
50
50
51
51
// ValidateCreate implements webhook.CustomValidator so a webhook will be registered for the type.
52
- func (r * OpenStackMachineTemplateWebhook ) ValidateCreate (_ context.Context , obj runtime.Object ) error {
52
+ func (r * OpenStackMachineTemplateWebhook ) ValidateCreate (_ context.Context , obj runtime.Object ) (admission. Warnings , error ) {
53
53
openStackMachineTemplate , ok := obj .(* OpenStackMachineTemplate )
54
54
if ! ok {
55
- return apierrors .NewBadRequest (fmt .Sprintf ("expected an OpenStackMachineTemplate but got a %T" , obj ))
55
+ return nil , apierrors .NewBadRequest (fmt .Sprintf ("expected an OpenStackMachineTemplate but got a %T" , obj ))
56
56
}
57
57
58
58
var allErrs field.ErrorList
@@ -65,21 +65,21 @@ func (r *OpenStackMachineTemplateWebhook) ValidateCreate(_ context.Context, obj
65
65
}
66
66
67
67
// ValidateUpdate implements webhook.CustomValidator so a webhook will be registered for the type.
68
- func (r * OpenStackMachineTemplateWebhook ) ValidateUpdate (ctx context.Context , oldRaw runtime.Object , newRaw runtime.Object ) error {
68
+ func (r * OpenStackMachineTemplateWebhook ) ValidateUpdate (ctx context.Context , oldRaw runtime.Object , newRaw runtime.Object ) (admission. Warnings , error ) {
69
69
var allErrs field.ErrorList
70
70
old , ok := oldRaw .(* OpenStackMachineTemplate )
71
71
if ! ok {
72
- return apierrors .NewBadRequest (fmt .Sprintf ("expected an OpenStackMachineTemplate but got a %T" , oldRaw ))
72
+ return nil , apierrors .NewBadRequest (fmt .Sprintf ("expected an OpenStackMachineTemplate but got a %T" , oldRaw ))
73
73
}
74
74
75
75
newObj , ok := newRaw .(* OpenStackMachineTemplate )
76
76
if ! ok {
77
- return apierrors .NewBadRequest (fmt .Sprintf ("expected an OpenStackMachineTemplate but got a %T" , oldRaw ))
77
+ return nil , apierrors .NewBadRequest (fmt .Sprintf ("expected an OpenStackMachineTemplate but got a %T" , oldRaw ))
78
78
}
79
79
80
80
req , err := admission .RequestFromContext (ctx )
81
81
if err != nil {
82
- return apierrors .NewBadRequest (fmt .Sprintf ("expected a admission.Request inside context: %v" , err ))
82
+ return nil , apierrors .NewBadRequest (fmt .Sprintf ("expected a admission.Request inside context: %v" , err ))
83
83
}
84
84
85
85
if ! topology .ShouldSkipImmutabilityChecks (req , newObj ) &&
@@ -93,6 +93,6 @@ func (r *OpenStackMachineTemplateWebhook) ValidateUpdate(ctx context.Context, ol
93
93
}
94
94
95
95
// ValidateDelete implements webhook.CustomValidator so a webhook will be registered for the type.
96
- func (r * OpenStackMachineTemplateWebhook ) ValidateDelete (_ context.Context , _ runtime.Object ) error {
97
- return nil
96
+ func (r * OpenStackMachineTemplateWebhook ) ValidateDelete (_ context.Context , _ runtime.Object ) (admission. Warnings , error ) {
97
+ return nil , nil
98
98
}
0 commit comments