Skip to content

Helm chart v4: no more getResource & how to use chart.resources #3251

@awoimbee

Description

@awoimbee

Hi,
When transitioning from Helm chart v3 to helm chart v4, we loose access to getResource.
The docs surrounding the resources output of helm chart v4 are very bare: resources any[] Resources created by the Chart..

From #3110 (comment):

Wanted to wonder if there's any guidelines on how to manage outputs better with the v4 Chart?
The v3 chart had getResource typed API which was very helpful.

From the docs it's not very clear how I'm supposed to do it. I switched some deployments from the v3 to the v4 chart and I end up with this sort of diff:

-  const clusterCrd = operatorChart.getResource("apiextensions.k8s.io/v1/CustomResourceDefinition", "rabbitmqclusters.rabbitmq.com").apply(c => notNull(c));
+  const clusterCrd = operatorChart.resources.apply(resources => {
+    for (const r of resources) {
+      if (r.__pulumiType === "kubernetes:apiextensions.k8s.io/v1:CustomResourceDefinition" && r.__name.endsWith("rabbitmqclusters.rabbitmq.com")) {
+        return r;
+      }
+    }
+    throw new Error("Could not find rabbitmq operator CRD");
+  });  

I previously posted a message on slack: https://pulumi-community.slack.com/archives/CRFURDVQB/p1728239416448769

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/helmimpact/usabilitySomething that impacts users' ability to use the product easily and intuitivelykind/enhancementImprovements or new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions