diff --git a/api/v1/gitrepository_types.go b/api/v1/gitrepository_types.go index f104fd0f1..59efabb03 100644 --- a/api/v1/gitrepository_types.go +++ b/api/v1/gitrepository_types.go @@ -96,6 +96,7 @@ type GitRepositorySpec struct { // Provider used for authentication, can be 'azure', 'github', 'generic'. // When not specified, defaults to 'generic'. // +kubebuilder:validation:Enum=generic;azure;github + // +kubebuilder:default:=generic // +optional Provider string `json:"provider,omitempty"` 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/api/v1/helmrepository_types.go b/api/v1/helmrepository_types.go index 1c19064a5..67a80f9fa 100644 --- a/api/v1/helmrepository_types.go +++ b/api/v1/helmrepository_types.go @@ -100,6 +100,7 @@ type HelmRepositorySpec struct { // and for remote OCI Repository operations like pulling for an OCI helm // chart by the associated HelmChart. // Its default value is 60s. + // +kubebuilder:default="60s" // +kubebuilder:validation:Type=string // +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m))+$" // +optional diff --git a/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml b/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml index 10663e473..103298ba8 100644 --- a/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml +++ b/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml @@ -104,6 +104,7 @@ spec: pattern: ^([0-9]+(\.[0-9]+)?(ms|s|m|h))+$ type: string provider: + default: generic description: |- Provider used for authentication, can be 'azure', 'github', 'generic'. When not specified, defaults to 'generic'. 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 diff --git a/config/crd/bases/source.toolkit.fluxcd.io_helmrepositories.yaml b/config/crd/bases/source.toolkit.fluxcd.io_helmrepositories.yaml index 750a36500..43a57de0c 100644 --- a/config/crd/bases/source.toolkit.fluxcd.io_helmrepositories.yaml +++ b/config/crd/bases/source.toolkit.fluxcd.io_helmrepositories.yaml @@ -162,6 +162,7 @@ spec: HelmRepository. type: boolean timeout: + default: 60s description: |- Timeout is used for the index fetch operation for an HTTPS helm repository, and for remote OCI Repository operations like pulling for an OCI helm