diff --git a/api/v1/helmchart_types.go b/api/v1/helmchart_types.go index 23cb24146..224d8533d 100644 --- a/api/v1/helmchart_types.go +++ b/api/v1/helmchart_types.go @@ -28,6 +28,7 @@ import ( const HelmChartKind = "HelmChart" // HelmChartSpec specifies the desired state of a Helm chart. +// +kubebuilder:validation:XValidation:rule="!has(self.verify) || self.sourceRef.kind == 'HelmRepository'",message="spec.verify is only supported when spec.sourceRef.kind is 'HelmRepository'" type HelmChartSpec struct { // Chart is the name or path the Helm chart is available at in the // SourceRef. diff --git a/config/crd/bases/source.toolkit.fluxcd.io_helmcharts.yaml b/config/crd/bases/source.toolkit.fluxcd.io_helmcharts.yaml index 0e57c72a5..50237f713 100644 --- a/config/crd/bases/source.toolkit.fluxcd.io_helmcharts.yaml +++ b/config/crd/bases/source.toolkit.fluxcd.io_helmcharts.yaml @@ -198,6 +198,9 @@ spec: - interval - sourceRef type: object + x-kubernetes-validations: + - message: spec.verify is only supported when spec.sourceRef.kind is 'HelmRepository' + rule: '!has(self.verify) || self.sourceRef.kind == ''HelmRepository''' status: default: observedGeneration: -1