I'm having trouble pulling service values from a h...
# general
b
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
cc @gorgeous-egg-16927
g
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
sweet, the explicit NS workaround got me going. thanks @gorgeous-egg-16927