Skip to content

Commit 00113a5

Browse files
author
Valeriy Khorunzhin
committed
add
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
1 parent 0c52e9a commit 00113a5

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

images/virtualization-artifact/pkg/controller/vmip/vmip_webhook.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,19 @@ func (v *Validator) ValidateCreate(ctx context.Context, obj runtime.Object) (adm
6565
return nil, fmt.Errorf("the VirtualMachineIPAddress validation is failed: %w", err)
6666
}
6767

68-
var warnings admission.Warnings
69-
7068
if vmip.Spec.StaticIP != "" {
7169
err = v.validateAllocatedIPAddresses(ctx, vmip.Spec.StaticIP)
7270
switch {
7371
case err == nil:
7472
// OK.
7573
case errors.Is(err, service.ErrIPAddressOutOfRange):
76-
warnings = append(warnings, fmt.Sprintf("The requested address %s is out of the valid range", vmip.Spec.StaticIP))
74+
return nil, fmt.Errorf("The requested address %s is out of the valid range", vmip.Spec.StaticIP)
7775
default:
7876
return nil, err
7977
}
8078
}
8179

82-
return warnings, nil
80+
return nil, nil
8381
}
8482

8583
func (v *Validator) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) (admission.Warnings, error) {

0 commit comments

Comments
 (0)