pulumi-kubernetes
                                
                                 pulumi-kubernetes copied to clipboard
                                
                                    pulumi-kubernetes copied to clipboard
                            
                            
                            
                        Helm cache corruption issue
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:
pulumi:pulumi:Stack baseline-k8s-dev.k8s.infratesting create error: Unhandled exception: Error: invocation of kubernetes:helm:template returned an error: failed to generate YAML for specified Helm chart: failed to pull chart: no cached repo found. (try 'helm repo update'):
Steps to reproduce
- See guide at https://azure.github.io/secrets-store-csi-driver-provider-azure/getting-started/installation/
- Write the following command: (amount of slashes after url has no effect - two used as this is what is present on the pulumi provider examples page)
const keyvaultCSI = new k8s.helm.v3.Chart("keyVaultCSI",{
        chart: "csi-secrets-store-provider-azure",
        version: "0.0.17",
        fetchOpts: {
            repo: "https://raw.githubusercontent.com/Azure/secrets-store-csi-driver-provider-azure/master/charts//"
        },
        values: {
            logFormatJSON: true,            
        }
    },{
        provider: cluster
    })
- Get error message as above
- Run:
helm repo add csi-secrets-store-provider-azure https://raw.githubusercontent.com/Azure/secrets-store-csi-driver-provider-azure/master/charts
"csi-secrets-store-provider-azure" has been added to your repositories
- Run pulumi again - get same error
- Run:
λ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "csi-secrets-store-provider-azure" chart repository
...
Update Complete. ⎈Happy Helming!⎈
- Run pulumi again - no error:
Previewing update (dev.k8s.infratesting):
 +  pulumi:pulumi:Stack baseline-k8s-dev.k8s.infratesting create
 +  kubernetes:helm.sh/v3:Chart keyVaultCSI create
 +  pulumi:pulumi:Stack baseline-k8s-dev.k8s.infratesting create read pulumi:pulumi:StackReference dev.infra.infratesting-reference
 +  pulumi:pulumi:Stack baseline-k8s-dev.k8s.infratesting create read pulumi:pulumi:StackReference dev.infra.infratesting-reference
 +  pulumi:providers:kubernetes clusterProvider create
 +  kubernetes:apps/v1:DaemonSet default/keyVaultCSI-secrets-store-csi-driver create
 +  kubernetes:apiextensions.k8s.io/v1:CustomResourceDefinition secretproviderclasspodstatuses.secrets-store.csi.x-k8s.io create
 +  kubernetes:storage.k8s.io/v1:CSIDriver secrets-store.csi.k8s.io create
 +  kubernetes:rbac.authorization.k8s.io/v1:ClusterRole secretprovidersyncing-role create
 +  kubernetes:rbac.authorization.k8s.io/v1:ClusterRole secretproviderclasses-role create
 +  kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding secretprovidersyncing-rolebinding create
 +  kubernetes:rbac.authorization.k8s.io/v1:ClusterRoleBinding secretproviderclasses-rolebinding create
 +  kubernetes:core/v1:ServiceAccount default/csi-secrets-store-provider-azure create
 +  kubernetes:core/v1:ServiceAccount default/secrets-store-csi-driver create
 +  kubernetes:apiextensions.k8s.io/v1:CustomResourceDefinition secretproviderclasses.secrets-store.csi.x-k8s.io create
 +  kubernetes:apps/v1:DaemonSet default/keyVaultCSI-csi-secrets-store-provider-azure create
 +  pulumi:pulumi:Stack baseline-k8s-dev.k8s.infratesting create
Resources:
    + 14 to create
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
#1505 -> https://github.com/helm/helm/issues/9533
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...