https://pulumi.com logo
#general
Title
# general
w

worried-city-86458

10/10/2019, 10:18 PM
I'm trying to update the prometheus operator helm chart:
Copy code
pulumi:pulumi:Stack (k8s-infra-dev):
    error: Error: Command failed: helm fetch stable/prometheus-operator --untar --version 6.16.0 --destination /tmp/tmp-333MmxKBHLF631a
    Error: chart "prometheus-operator" matching version "6.16.0" not found in stable index. (try 'helm repo update'). No chart version found for prometheus-operator-6.16.0
 
    Error: chart "prometheus-operator" matching version "6.16.0" not found in stable index. (try 'helm repo update'). No chart version found for prometheus-operator-6.16.0
    Error: Error: Command failed: helm fetch stable/prometheus-operator --untar --version 6.16.0 --destination /tmp/tmp-333MmxKBHLF631a
    Error: chart "prometheus-operator" matching version "6.16.0" not found in stable index. (try 'helm repo update'). No chart version found for prometheus-operator-6.16.0
        at /workspaces/devops-gemini-pulumi/k8s-infra/node_modules/@pulumi/kubernetes/helm/v2/helm.js:112:23
        at OutputImpl.<anonymous> (/workspaces/devops-gemini-pulumi/k8s-infra/node_modules/@pulumi/pulumi/output.js:110:47)
        at Generator.next (<anonymous>)
        at fulfilled (/workspaces/devops-gemini-pulumi/k8s-infra/node_modules/@pulumi/pulumi/output.js:18:58)
Is it expected to need to run
helm repo update
?
After doing that manually the update nearly succeeded:
Copy code
pulumi:pulumi:Stack (k8s-infra-dev):
    error: update failed
 
  kubernetes:policy:PodSecurityPolicy (monitoring/po-grafana):
    error: Plan apply failed: resource monitoring/po-grafana was not successfully created by the Kubernetes API server : podsecuritypolicies.policy "po-grafana" already exists
Ran again and preview looks like the following:
Copy code
Type                                           Name                   Plan
     pulumi:pulumi:Stack                            k8s-infra-dev
     └─ kubernetes:helm.sh:Chart                    po
 +      ├─ kubernetes:policy:PodSecurityPolicy      monitoring/po-grafana  create
 -      └─ kubernetes:extensions:PodSecurityPolicy  monitoring/po-grafana  delete
Is this a case of the resource api versions changing and not being picked up by Pulumi?
g

gorgeous-egg-16927

10/10/2019, 10:34 PM
Yeah, Pulumi just interacts with helm on your system, so you have to run
helm repo update
to pull in new chart info.
We aren’t currently auto-aliasing PSPs, so that would explain the error you’re seeing
https://github.com/pulumi/pulumi-kubernetes/issues/828 is tracking getting those added for all resources types
w

worried-city-86458

10/10/2019, 10:49 PM
Thanks. Is there a workaround to specify the alias myself?
So for CI/CD, we should always run
helm repo update
outside of Pulumi?
g

gorgeous-egg-16927

10/10/2019, 11:04 PM
You could specify the alias with a transformation along the lines of https://github.com/pulumi/pulumi-kubernetes/blob/049ce63bcafb65b12a2b89621ac6a399118844db/sdk/nodejs/helm/v2/helm.ts#L43-L60 I think
Copy code
transformations: [
    (obj: any, opts: pulumi.CustomResourceOptions) => {
        if (obj.kind === "PodSecurityPolicy") {
            opts.aliases = [
                { parent: opts.parent, type: "kubernetes:policy/v1beta1:PodSecurityPolicy"},
                { parent: opts.parent, type: "kubernetes:extensions/v1beta1:PodSecurityPolicy"},
            ];
        }
    },
],
would work
I’d run
helm repo update
after it gets installed in your CI pipeline
w

worried-city-86458

10/10/2019, 11:24 PM
The transform worked great, thanks again.
👍 1