feat: resolved values files are persisted to and retrieved from the [HelmChart.Status.ObservedValuesFiles] field
Signed-off-by: Paulo Canilho <paulo.canilho@nexthink.com>
This commit is contained in:
parent
b84ab9e698
commit
bf97748339
|
@ -147,6 +147,10 @@ type HelmChartStatus struct {
|
|||
// +optional
|
||||
ObservedChartName string `json:"observedChartName,omitempty"`
|
||||
|
||||
// ObservedValuesFiles are the last observed value files.
|
||||
// +optional
|
||||
ObservedValuesFiles []string `json:"observedValuesFiles,omitempty"`
|
||||
|
||||
// Conditions holds the conditions for the HelmChart.
|
||||
// +optional
|
||||
Conditions []metav1.Condition `json:"conditions,omitempty"`
|
||||
|
|
|
@ -666,6 +666,7 @@ func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *
|
|||
cb := chart.NewRemoteBuilder(chartRepo)
|
||||
opts := chart.BuildOptions{
|
||||
ValuesFiles: obj.GetValuesFiles(),
|
||||
ObservedValuesFiles: obj.Status.ObservedValuesFiles,
|
||||
IgnoreMissingValuesFiles: obj.Spec.IgnoreMissingValuesFiles,
|
||||
Force: obj.Generation != obj.Status.ObservedGeneration,
|
||||
// The remote builder will not attempt to download the chart if
|
||||
|
@ -762,6 +763,7 @@ func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj
|
|||
// Configure builder options, including any previously cached chart
|
||||
opts := chart.BuildOptions{
|
||||
ValuesFiles: obj.GetValuesFiles(),
|
||||
ObservedValuesFiles: obj.Status.ObservedValuesFiles,
|
||||
IgnoreMissingValuesFiles: obj.Spec.IgnoreMissingValuesFiles,
|
||||
Force: obj.Generation != obj.Status.ObservedGeneration,
|
||||
}
|
||||
|
@ -886,6 +888,7 @@ func (r *HelmChartReconciler) reconcileArtifact(ctx context.Context, _ *patch.Se
|
|||
// Record it on the object
|
||||
obj.Status.Artifact = artifact.DeepCopy()
|
||||
obj.Status.ObservedChartName = b.Name
|
||||
obj.Status.ObservedValuesFiles = b.ValuesFiles
|
||||
|
||||
// Update symlink on a "best effort" basis
|
||||
symURL, err := r.Storage.Symlink(artifact, "latest.tar.gz")
|
||||
|
|
|
@ -107,6 +107,9 @@ type BuildOptions struct {
|
|||
// ValuesFiles can be set to a list of relative paths, used to compose
|
||||
// and overwrite an alternative default "values.yaml" for the chart.
|
||||
ValuesFiles []string
|
||||
// ObservedValuesFiles is calculated when the chart is built. If BuildOptions.IgnoreMissingValuesFiles is set,
|
||||
// this list will contain the values files that were actually found on disk.
|
||||
ObservedValuesFiles []string
|
||||
// IgnoreMissingValuesFiles controls whether to silently ignore missing values files rather than failing.
|
||||
IgnoreMissingValuesFiles bool
|
||||
// CachedChart can be set to the absolute path of a chart stored on
|
||||
|
|
|
@ -120,7 +120,7 @@ func (b *localChartBuilder) Build(ctx context.Context, ref Reference, p string,
|
|||
if err = curMeta.Validate(); err == nil {
|
||||
if result.Name == curMeta.Name && result.Version == curMeta.Version {
|
||||
result.Path = opts.CachedChart
|
||||
result.ValuesFiles = opts.GetValuesFiles()
|
||||
result.ValuesFiles = opts.ObservedValuesFiles
|
||||
result.Packaged = requiresPackaging
|
||||
|
||||
return result, nil
|
||||
|
|
|
@ -202,7 +202,7 @@ func generateBuildResult(cv *repo.ChartVersion, opts BuildOptions) (*Build, bool
|
|||
if err = curMeta.Validate(); err == nil {
|
||||
if result.Name == curMeta.Name && result.Version == curMeta.Version {
|
||||
result.Path = opts.CachedChart
|
||||
result.ValuesFiles = opts.GetValuesFiles()
|
||||
result.ValuesFiles = opts.ObservedValuesFiles
|
||||
result.Packaged = requiresPackaging
|
||||
return result, true, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue