0
votes

I am building a pipeline that will be used to launch a number of helm charts in different environments. The main Helm (v3.0.2) Chart for this has a number of dependencies that can be found in the stable helm repository. This is added in all environments but, for reasons that I will spare you from, they have been added with different names.
According to the Helm documentation you should be able to define the repository either by name or by URL, as long as it is still added to your helm repo list.
However, if I try that and run helm dependency update myHelmChart I get a could not find chart error.

Example:

Env1:

$ helm repo list
NAME        URL                                              
stable      https://kubernetes-charts.storage.googleapis.com/

Env2:

$ helm repo list
NAME        URL                                              
cf_stable   https://kubernetes-charts.storage.googleapis.com/

Chart.yaml

...
dependencies: 
  - name: nginx-ingress
    version: 1.37.0
    repository: https://kubernetes-charts.storage.googleapis.com/charts
  - name: ......

Now running the dependency update in Env1 looks like this:

helm dependency update myHelmChart
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 1 charts
Downloading nginx-ingress from repo https://kubernetes-charts.storage.googleapis.com/charts
Save error occurred:  could not find : chart nginx-ingress not found in https://kubernetes-charts.storage.googleapis.com/charts
Deleting newly downloaded charts, restoring pre-update state
Error: could not find : chart nginx-ingress not found in https://kubernetes-charts.storage.googleapis.com/charts

If I change the Chart.yaml to hold repository: "@stable" it will run fine in Env1 but will fail in Env2. What am I doing wrong? How can I solve this so I don't have to rely on all environments using the exact same repo names?

1

1 Answers

1
votes

It turns out that even though the documentation states that the URL should include /charts and typing https://kubernetes-charts.storage.googleapis.com/index.yaml in a browser redirects to https://kubernetes-charts.storage.googleapis.com/charts/index.yaml and retrieves the file, directly using the /charts/index.yaml extension does not retrieve the file.

The solution was to remove the /charts extension from my repository URL.
This may not be the case for all repositories so you may need to test them manually to get the correct path.