diff --git a/crd/overlayextensionconfig/api/v1alpha1/overlayextensionconfig_types.go b/crd/overlayextensionconfig/api/v1alpha1/overlayextensionconfig_types.go index c3d256e5d..9d5d220d5 100644 --- a/crd/overlayextensionconfig/api/v1alpha1/overlayextensionconfig_types.go +++ b/crd/overlayextensionconfig/api/v1alpha1/overlayextensionconfig_types.go @@ -31,9 +31,13 @@ type OverlayExtensionConfigList struct { } // OverlayExtensionConfigSpec defines the desired state of OverlayExtensionConfig. +// +kubebuilder:validation:XValidation:rule="!has(oldSelf.extensionIPRange) || has(self.extensionIPRange)", message="ExtensionIPRange is required once set" type OverlayExtensionConfigSpec struct { // ExtensionIPRange field defines a CIDR that should be able to reach routing domain ip addresses. // +kubebuilder:validation:Optional + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable" + // +kubebuilder:validation:MaxLength=43 + // 43 is max length of IPv6 CIDR string ExtensionIPRange string `json:"extensionIPRange,omitempty"` } diff --git a/crd/overlayextensionconfig/manifests/acn.azure.com_overlayextensionconfigs.yaml b/crd/overlayextensionconfig/manifests/acn.azure.com_overlayextensionconfigs.yaml index 54412ff97..418691c2a 100644 --- a/crd/overlayextensionconfig/manifests/acn.azure.com_overlayextensionconfigs.yaml +++ b/crd/overlayextensionconfig/manifests/acn.azure.com_overlayextensionconfigs.yaml @@ -48,10 +48,18 @@ spec: description: OverlayExtensionConfigSpec defines the desired state of OverlayExtensionConfig. properties: extensionIPRange: - description: ExtensionIPRange field defines a CIDR that should be - able to reach routing domain ip addresses. + description: |- + ExtensionIPRange field defines a CIDR that should be able to reach routing domain ip addresses. + 43 is max length of IPv6 CIDR string + maxLength: 43 type: string + x-kubernetes-validations: + - message: Value is immutable + rule: self == oldSelf type: object + x-kubernetes-validations: + - message: ExtensionIPRange is required once set + rule: '!has(oldSelf.extensionIPRange) || has(self.extensionIPRange)' status: description: OverlayExtensionConfigStatus defines the observed state of OverlayExtensionConfig