Skip to content

Commit

Permalink
Make site immutable (#127)
Browse files Browse the repository at this point in the history
Reference:
- #100
  • Loading branch information
henrybear327 authored Nov 11, 2024
1 parent 3282272 commit 52d94b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/v1/prefixclaim_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/netbox.dev_prefixclaims.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 52d94b9

Please sign in to comment.