From 4b7c6de453c3ebbebb5dfb5167f993767d6a5604 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 9 Apr 2026 18:49:59 +0300 Subject: [PATCH] add Signed-off-by: Valeriy Khorunzhin --- .../pkg/controller/vmip/vmip_webhook.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/images/virtualization-artifact/pkg/controller/vmip/vmip_webhook.go b/images/virtualization-artifact/pkg/controller/vmip/vmip_webhook.go index 89a78edb66..fb7da2e470 100644 --- a/images/virtualization-artifact/pkg/controller/vmip/vmip_webhook.go +++ b/images/virtualization-artifact/pkg/controller/vmip/vmip_webhook.go @@ -65,21 +65,19 @@ func (v *Validator) ValidateCreate(ctx context.Context, obj runtime.Object) (adm return nil, fmt.Errorf("the VirtualMachineIPAddress validation is failed: %w", err) } - var warnings admission.Warnings - if vmip.Spec.StaticIP != "" { err = v.validateAllocatedIPAddresses(ctx, vmip.Spec.StaticIP) switch { case err == nil: // OK. case errors.Is(err, service.ErrIPAddressOutOfRange): - warnings = append(warnings, fmt.Sprintf("The requested address %s is out of the valid range", vmip.Spec.StaticIP)) + return nil, fmt.Errorf("the requested address %s is out of the valid range", vmip.Spec.StaticIP) default: return nil, err } } - return warnings, nil + return nil, nil } func (v *Validator) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {