Open headconnect opened 3 years ago
I've run into this problem as well. It was frustrating because I anticipated to not have to install helm for making pulumi work with helm charts as it states that it bundles the helm go implementation directly.
Turns out that I had old files of a repository lying around. Seems like does work once I remove the old repository using helm repo remove ...
I'm also hitting this every now and then. As above I presume the helm cli is not actually needed by pulumi, but it's installed for other reasons, so it would be great if pulumi could somehow bypass requiring a helm repo update
...
This is still a helm issue (I created a new issue https://github.com/helm/helm/issues/11961) to better document what's going on.
Generally speaking, helm is failing because it's expecting there to be a cache even if the command is targeting a remote repo/chart; that cache gets cleared periodically (at least on Windows) causing helm to freak out even though it shouldn't need the cache anyway.
A workaround is to just run helm repo update
to make sure the cache gets filled again of whatever local repos you have. If it makes sense for you, you can also remove the local helm repos so it doesn't think there's a missing cache.
Thanks again @mikeseese for the analysis and efforts to fix the upstream issue (https://github.com/helm/helm/issues/11961). Helm assumes that the repo cache is valid for all added repositories, even if the installation task doesn't rely on those repositories.
TLDR; this happens when you've added a repository to Helm (helm repo add
) and then cleared the repository cache. Helm doesn't automatically rebuild the cache.
The workaround is to a) remove the repo (helm repo remove REPO-NAME
) or b) rebuild the cache (helm repo update
).
An easy repro for this issue is to customize the cache location, e.g.
$ helm repo add nginx https://helm.nginx.com/stable
$ mkdir ./helm
$ export HELM_REPOSITORY_CACHE=./helm/repository
$ helm template --repo https://helm.nginx.com/stable nginx-ingress
Error: no cached repo found. (try 'helm repo update'): open helm/repository/nginx-index.yaml: no such file or directory
It is apparent that the template
command doesn't automatically do helm repo update
, it simply assumes the cache is good. That's true only for the main chart, because it does automatically update the repo cache as necessary while resolving the chart's dependencies. https://github.com/helm/helm/pull/11963 allows Helm to skip over bad cache entries, but doesn't seek to solve the broader issue.
To be clear, this issue manifests itself only when the repo URL is found in the set of locally-configured repositories. If we set HELM_REPOSITORY_CONFIG
to an empty file, Helm appears to download and cache automatically as expected. This means that the "adhoc repo" use-case works today as expected.
$ mkdir ./helm
$ touch ./helm/repositories.yaml
$ export HELM_REPOSITORY_CONFIG=./helm/repositories.yaml
$ export HELM_REPOSITORY_CACHE=./helm/repository
$ helm template --repo https://helm.nginx.com/stable nginx-ingress
---
# Source: nginx-ingress/templates/controller-serviceaccount.yaml
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
name: nginx
...
When attempting to add Azure Key Vault Provider for Secrets Store CSI Driver to my cluster, pulumi failed with an error message stating: "Failed to generate YAML for specified Helm chart: failed to pull chart: no cached repo found. (try 'helm repo update')."
I had not previously pulled the repo with helm, nor had I run helm update.
Expected behavior
The remote chart repo should be added and updated prior to template being executed.
Current behavior
Without adding the chart manuall, it fails with the following error:
Steps to reproduce
Run pulumi again - no error:
Resources:
Context (Environment)
Run with pulumi 2.24.1, pulumi-kubernetes 2.8.4, using pulumi/x/automation.
Could also be linked to https://github.com/pulumi/pulumi-kubernetes/issues/1505
Affected feature