From bca7983d77c5731ebb42f7dfc6c3c0a9699c9a62 Mon Sep 17 00:00:00 2001
From: Robin Breathe
Date: Wed, 17 Apr 2024 16:36:07 +0200
Subject: [PATCH] feat(HelmChartTemplateSpec): optionally ignore missing
valuesFiles
Signed-off-by: Robin Breathe
---
api/v2beta2/helmrelease_types.go | 4 ++++
.../helm.toolkit.fluxcd.io_helmreleases.yaml | 4 ++++
docs/api/v2beta2/helm.md | 24 +++++++++++++++++++
internal/reconcile/helmchart_template.go | 7 +++---
4 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/api/v2beta2/helmrelease_types.go b/api/v2beta2/helmrelease_types.go
index 9db38102f..05c88b8fc 100644
--- a/api/v2beta2/helmrelease_types.go
+++ b/api/v2beta2/helmrelease_types.go
@@ -376,6 +376,10 @@ type HelmChartTemplateSpec struct {
// +deprecated
ValuesFile string `json:"valuesFile,omitempty"`
+ // IgnoreMissingValuesFiles controls whether to silently ignore missing values files rather than failing.
+ // +optional
+ IgnoreMissingValuesFiles bool `json:"ignoreMissingValuesFiles,omitempty"`
+
// Verify contains the secret name containing the trusted public keys
// used to verify the signature and specifies which provider to use to check
// whether OCI image is authentic.
diff --git a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
index a22580aa3..94900003b 100644
--- a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
+++ b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
@@ -1320,6 +1320,10 @@ spec:
maxLength: 2048
minLength: 1
type: string
+ ignoreMissingValuesFiles:
+ description: IgnoreMissingValuesFiles controls whether to
+ silently ignore missing values files rather than failing.
+ type: boolean
interval:
description: |-
Interval at which to check the v1.Source for updates. Defaults to
diff --git a/docs/api/v2beta2/helm.md b/docs/api/v2beta2/helm.md
index 020813053..30d232b14 100644
--- a/docs/api/v2beta2/helm.md
+++ b/docs/api/v2beta2/helm.md
@@ -807,6 +807,18 @@ ValuesFiles items. Ignored when omitted.
+ignoreMissingValuesFiles
+
+bool
+
+ |
+
+(Optional)
+ IgnoreMissingValuesFiles controls whether to silently ignore missing values files rather than failing.
+ |
+
+
+
verify
@@ -999,6 +1011,18 @@ ValuesFiles items. Ignored when omitted.
|
+ignoreMissingValuesFiles
+
+bool
+
+ |
+
+(Optional)
+ IgnoreMissingValuesFiles controls whether to silently ignore missing values files rather than failing.
+ |
+
+
+
verify
diff --git a/internal/reconcile/helmchart_template.go b/internal/reconcile/helmchart_template.go
index 2dd82e2b2..aa0772052 100644
--- a/internal/reconcile/helmchart_template.go
+++ b/internal/reconcile/helmchart_template.go
@@ -226,9 +226,10 @@ func buildHelmChartFromTemplate(obj *v2.HelmRelease) *sourcev1.HelmChart {
Name: template.Spec.SourceRef.Name,
Kind: template.Spec.SourceRef.Kind,
},
- Interval: template.GetInterval(obj.Spec.Interval),
- ReconcileStrategy: template.Spec.ReconcileStrategy,
- ValuesFiles: template.Spec.ValuesFiles,
+ Interval: template.GetInterval(obj.Spec.Interval),
+ ReconcileStrategy: template.Spec.ReconcileStrategy,
+ ValuesFiles: template.Spec.ValuesFiles,
+ IgnoreMissingValuesFiles: template.Spec.IgnoreMissingValuesFiles,
},
}
if verifyTpl := template.Spec.Verify; verifyTpl != nil {
|