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

busy-umbrella-36067

12/06/2019, 6:51 PM
I'm having trouble pulling service values from a helm chart. Types don't complain until runtime
TypeError: Cannot read property 'status' of undefined
Copy code
const grafanaChart = new helm.v2.Chart(
    "grafana",
    {
      chart: "stable/grafana",
      values: {
        service: { type: "LoadBalancer" },
        testFramework: { enabled: false }
      }
    }
  );

  cosnt grafanaHostname = grafanaChart.getResource('v1/Service', 'grafana').apply(svc => svc.status.loadBalancer.ingress[0].hostname)
m

microscopic-florist-22719

12/06/2019, 7:22 PM
cc @gorgeous-egg-16927
g

gorgeous-egg-16927

12/06/2019, 7:57 PM
Hmm, for some reason it’s only working for me when I explicitly specify the namespace for the service.
Copy code
const grafanaChart = new k8s.helm.v2.Chart(
    "grafana",
    {
        chart: "stable/grafana",
        values: {
            service: { type: "LoadBalancer" },
            testFramework: { enabled: false }
        }
    }
);
export const grafanaHostname = grafanaChart
    .getResourceProperty("v1/Service", "default/grafana", "status")
    .apply(status => status.loadBalancer.ingress[0].hostname);
export const grafanaService = grafanaChart
    .getResource("v1/Service", "default/grafana");
I’ll file an issue to track
👍 1
b

busy-umbrella-36067

12/06/2019, 8:22 PM
sweet, the explicit NS workaround got me going. thanks @gorgeous-egg-16927