Hi, Pulumi Team. Wonderful tool, had fun exploring...
# general
v
Hi, Pulumi Team. Wonderful tool, had fun exploring it’s abilities. Struggled with the helm chart installation, specifically kube-prometheus-stack. Following code fails to create entities based on CRD’s, I guess chart doesn’t install them.
Copy code
from pulumi_kubernetes.helm.v3 import Chart, ChartOpts, FetchOpts

# ...

def remove_status(obj, opts):
    if obj["kind"] == "CustomResourceDefinition":
        del obj["status"]

prometheus_stack_chart = Chart(
    "prometheus-stack",
    ChartOpts(
        chart="kube-prometheus-stack",
        transformations=[remove_status],
        version="34.8.0",
        fetch_opts=FetchOpts(
            repo="<https://prometheus-community.github.io/helm-charts>",
        ),
        namespace=monitoring_namespace.id,
        values=values,
        skip_await=False
    ),
    pulumi.ResourceOptions(depends_on=[monitoring_namespace, cluster])
)
I may notice the
remove_status
hack (I’ve found on the Internet), without it installation fails before the beginning, ’cause somewhere inside it tries to pass that
status
argument to a function that doesn’t expect it. Am I doing something wrong, or am I just unlucky to need the Chart that is trouble to install with pulumi? Do you have any ideas or suggestions?
p
Can you confirm that CRD are not installed once the following code is executed?
v
Yes, they were partially installed. I saw only one out of 8.
p
I see. I’ll try to repro it on my side but I’m pretty swamped with work today.
🙏 1
g
I had some problems with a chart that required helm hooks and the solution was to use
pulumi_kubernetes.helm.v3.Release
instead of
Chart
1
p
@great-sunset-355 might be on to something. I remember now that pulumi provided (later) a dedicated support for helm releases. That differs a lot compared to the Chart resource that basically renders the helm chart and applies the generated manifests one by one (without creating a helm release).
v
hm, thanks a lot, I’ll try to use
Release
p
@victorious-continent-984 any success with the
HelmRelease
approach? I'm running into the following problem:
Copy code
Use Helm CLI to investigate.: failed to become available within allocated timeout. Error: Helm Release monitoring/kube-prometheus: unable to build kubernetes objects from new release manifest: unable to recognize "":
my code:
Copy code
new k8s.helm.v3.Release(
      `${name}-kube-prometheus`,
      {
        chart: 'kube-prometheus-stack',
        version: '37.3.0',
        namespace: this.namespace,
        createNamespace: false,
        skipCrds: true,
        repositoryOpts: { repo: '<https://prometheus-community.github.io/helm-charts>' },
      },
      { ...this.OPTS, dependsOn: namespace },
    );
I was trying to play with the
skipAwait
flag but it doesn't change the result. CRDs are all installed correctly. Also setting a
name
for the
HelmRelease
didn't change anything. Any ideas?
v
Release resource worked fine for me. Some times it’s better to remove the helm release with CLI and create it again with pulumi.
And if I’m not mistaken
dependsOn
should be an array
And that there’s proper k8s provider set within opts
p
I will try again with a clean state - regarding the
dependsOn
key: documentation allows both array and single item values
Copy code
/**
     * An optional additional explicit dependencies on other resources.
     */
    dependsOn?: Input<Input<Resource>[]> | Input<Resource>;
the k8s provider is set within the
this.OPTS
object and also works fine for any other kubernetes resource I'm spinning up using pulumi