From 52d94b9486664da69f6b6209c6c1bf8d3b76fe54 Mon Sep 17 00:00:00 2001 From: Chun-Hung Tseng Date: Mon, 11 Nov 2024 16:00:42 +0100 Subject: [PATCH] Make site immutable (#127) Reference: - https://github.com/netbox-community/netbox-operator/issues/100 --- api/v1/prefixclaim_types.go | 2 +- config/crd/bases/netbox.dev_prefixclaims.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/v1/prefixclaim_types.go b/api/v1/prefixclaim_types.go index 46ee04a..7219b45 100644 --- a/api/v1/prefixclaim_types.go +++ b/api/v1/prefixclaim_types.go @@ -39,7 +39,7 @@ type PrefixClaimSpec struct { //+kubebuilder:validation:XValidation:rule="self == oldSelf",message="Field 'prefixLength' is immutable" PrefixLength string `json:"prefixLength"` - //+kubebuilder:validation:XValidation:rule="self == oldSelf || self != ''",message="Field 'site' is required once set" + //+kubebuilder:validation:XValidation:rule="self == oldSelf",message="Field 'site' is immutable" Site string `json:"site,omitempty"` //+kubebuilder:validation:XValidation:rule="self == oldSelf",message="Field 'tenant' is immutable" diff --git a/config/crd/bases/netbox.dev_prefixclaims.yaml b/config/crd/bases/netbox.dev_prefixclaims.yaml index b9cb7cd..9f322ae 100644 --- a/config/crd/bases/netbox.dev_prefixclaims.yaml +++ b/config/crd/bases/netbox.dev_prefixclaims.yaml @@ -79,8 +79,8 @@ spec: site: type: string x-kubernetes-validations: - - message: Field 'site' is required once set - rule: self == oldSelf || self != '' + - message: Field 'site' is immutable + rule: self == oldSelf tenant: type: string x-kubernetes-validations: