Skip to content

Commit

Permalink
feat(HelmChartTemplateSpec): optionally ignore missing valuesFiles
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Breathe <[email protected]>
  • Loading branch information
isometry committed Apr 18, 2024
1 parent 5e760db commit 370be06
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 4 deletions.
4 changes: 4 additions & 0 deletions api/v2beta1/helmrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,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.
Expand Down
4 changes: 4 additions & 0 deletions api/v2beta2/helmrelease_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ spec:
description: The name or path the Helm chart is available
at in the SourceRef.
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 v1beta2.Source for updates. Defaults to
Expand Down Expand Up @@ -1320,6 +1324,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
Expand Down
12 changes: 12 additions & 0 deletions docs/api/v2beta1/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,18 @@ ValuesFiles items. Ignored when omitted.</p>
</tr>
<tr>
<td>
<code>ignoreMissingValuesFiles</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to silently ignore missing values files rather than failing.</p>
</td>
</tr>
<tr>
<td>
<code>verify</code><br>
<em>
<a href="#helm.toolkit.fluxcd.io/v2beta1.HelmChartTemplateVerification">
Expand Down
24 changes: 24 additions & 0 deletions docs/api/v2beta2/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,18 @@ ValuesFiles items. Ignored when omitted.</p>
</tr>
<tr>
<td>
<code>ignoreMissingValuesFiles</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to silently ignore missing values files rather than failing.</p>
</td>
</tr>
<tr>
<td>
<code>verify</code><br>
<em>
<a href="#helm.toolkit.fluxcd.io/v2beta2.HelmChartTemplateVerification">
Expand Down Expand Up @@ -999,6 +1011,18 @@ ValuesFiles items. Ignored when omitted.</p>
</tr>
<tr>
<td>
<code>ignoreMissingValuesFiles</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>Whether to silently ignore missing values files rather than failing.</p>
</td>
</tr>
<tr>
<td>
<code>verify</code><br>
<em>
<a href="#helm.toolkit.fluxcd.io/v2beta2.HelmChartTemplateVerification">
Expand Down
4 changes: 4 additions & 0 deletions docs/spec/v2beta1/helmreleases.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ type HelmChartTemplateSpec struct {
// +optional
// +deprecated
ValuesFile string `json:"valuesFile,omitempty"`

// IgnoreMissingValuesFiles controls whether to silently ignore missing values files rather than failing.
// +optional
IgnoreMissingValuesFiles bool `json:"ignoreMissingValuesFiles,omitempty"`
}

// Install holds the configuration for Helm install actions performed for this
Expand Down
9 changes: 5 additions & 4 deletions internal/reconcile/helmchart_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@ 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,
ValuesFile: template.Spec.ValuesFile,
Interval: template.GetInterval(obj.Spec.Interval),
ReconcileStrategy: template.Spec.ReconcileStrategy,
ValuesFiles: template.Spec.ValuesFiles,
ValuesFile: template.Spec.ValuesFile,
IgnoreMissingValuesFiles: template.Spec.IgnoreMissingValuesFiles,
},
}
if verifyTpl := template.Spec.Verify; verifyTpl != nil {
Expand Down

0 comments on commit 370be06

Please sign in to comment.