From b2572e637ece6e73fe845f90f22d646f8956dde7 Mon Sep 17 00:00:00 2001 From: Arush Sharma Date: Wed, 19 Feb 2025 17:44:53 -0800 Subject: [PATCH] fix documentation templating bug --- templates/apis/crd.go.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/apis/crd.go.tpl b/templates/apis/crd.go.tpl index 4a1933b1..ad57b72b 100644 --- a/templates/apis/crd.go.tpl +++ b/templates/apis/crd.go.tpl @@ -20,13 +20,13 @@ type {{ .CRD.Kind }}Spec struct { {{ $field.GetDocumentation }} {{ end -}} -{{- if $field.IsImmutable }} +{{- if $field.IsImmutable -}} // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable once set" -{{- end }} +{{ end -}} -{{- if and ($field.IsRequired) (not $field.HasReference) }} +{{- if and ($field.IsRequired) (not $field.HasReference) -}} // +kubebuilder:validation:Required -{{- end }} +{{ end -}} {{ $field.Names.Camel }} {{ $field.GoType }} {{ $field.GetGoTag }} {{- end }}