pulumi-kubernetes icon indicating copy to clipboard operation
pulumi-kubernetes copied to clipboard

Helm cache corruption issue

Open headconnect opened this issue 4 years ago • 6 comments

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

  1. See guide at https://azure.github.io/secrets-store-csi-driver-provider-azure/getting-started/installation/
  2. 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
    })
  1. Get error message as above
  2. 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
  1. Run pulumi again - get same error
  2. 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!⎈
  1. 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

headconnect avatar Apr 06 '21 07:04 headconnect

#1505 -> https://github.com/helm/helm/issues/9533

MatteoCalabro-TomTom avatar Apr 08 '21 07:04 MatteoCalabro-TomTom

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 ...

gregmuellegger avatar Mar 03 '22 08:03 gregmuellegger

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...

gitfool avatar Jun 08 '22 23:06 gitfool