From 946d1e6ac058d8baf1ec6a52b2bd5f883dc238df Mon Sep 17 00:00:00 2001 From: Aurel Canciu Date: Fri, 30 Oct 2020 19:08:41 +0200 Subject: [PATCH] Remove use of chartutil.ProcessDependencies It looks like the use of chartutil.ProcessDependencies in the HelmChart Controller was not correct, this method seems to be used in Helm only during install/upgrade. The intention was to load the dependencies but this seems to not be needed as it's already done through the loaders (loader.Load). The use of this method caused a regression where Chart.yaml files would be overwritten and registered subcharts that had aliases would be renamed using the alias name. While this is an expected behaviour of chartutil.ProcessDependencies it is not what the controller should do to the chart during (re)packaging. Signed-off-by: Aurel Canciu --- controllers/helmchart_controller.go | 6 ------ controllers/testdata/charts/helmchartwithdeps/Chart.yaml | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/controllers/helmchart_controller.go b/controllers/helmchart_controller.go index 398a8860..e5a14928 100644 --- a/controllers/helmchart_controller.go +++ b/controllers/helmchart_controller.go @@ -446,12 +446,6 @@ func (r *HelmChartReconciler) reconcileFromTarballArtifact(ctx context.Context, isDir := chartFileInfo.IsDir() switch { case isDir: - // Load dependencies - if err = chartutil.ProcessDependencies(helmChart, helmChart.Values); err != nil { - err = fmt.Errorf("failed to process chart dependencies: %w", err) - return sourcev1.HelmChartNotReady(chart, sourcev1.StorageOperationFailedReason, err.Error()), err - } - // Determine chart dependencies deps := helmChart.Dependencies() reqs := helmChart.Metadata.Dependencies diff --git a/controllers/testdata/charts/helmchartwithdeps/Chart.yaml b/controllers/testdata/charts/helmchartwithdeps/Chart.yaml index 68bfe8b0..99dac50b 100644 --- a/controllers/testdata/charts/helmchartwithdeps/Chart.yaml +++ b/controllers/testdata/charts/helmchartwithdeps/Chart.yaml @@ -24,6 +24,10 @@ dependencies: - name: helmchart version: "0.1.0" repository: "file://../helmchart" + - name: helmchart + alias: aliased + version: "0.1.0" + repository: "file://../helmchart" - name: grafana version: ">=5.7.0" repository: "https://grafana.github.io/helm-charts"