Greetings. Is there a way to wait for `k8s.helm.v3...
# general
a
Greetings. Is there a way to wait for
k8s.helm.v3.Release
to fully install all its resources to get a reference to a resource created by the helm release? What I’m trying to achieve is install an
istio/gateway
helm release and get the k8s Service it creates, to get the Service’s external IP. I’m getting the resource like this: `const gatewayService = k8s.core.v1.Service.get("istio-gateway-service", pulumi.interpolate`${gateway.namespace}/${gateway.name}`, { dependsOn: [gateway] });` but it fails with
error: Preview failed: resource 'istio-system/istio-ingressgateway' does not exist
and that’s pretty obvious, why would it exist during the preview, when the release is not installed at all?
b
this should not fail, can you share your whole code?
a
The thing is that code works perfectly fine if I comment out the
Service.get
, run
pulumi up
, then return the
Service.get
and run
pulumi up
again. But I’d like not to do that for every stack.
Sure, here is the code:
Copy code
const gateway = new k8s.helm.v3.Release('istio-gateway', {
    name: 'istio-ingressgateway',
    chart: 'gateway',
    createNamespace: true,
    namespace: 'istio-system',
    forceUpdate: true,
    repositoryOpts: {
      repo: '<https://istio-release.storage.googleapis.com/charts>',
    },
    values: {
      labels: {
        app: 'istio-ingressgateway',
        istio: 'ingressgateway',
      },
    },
  }, {
    provider,
    dependsOn: [istiod],
  });

  const gatewayService = k8s.core.v1.Service.get("istio-gateway-service", pulumi.interpolate`${gateway.namespace}/${gateway.name}`, { dependsOn: [gateway] });
  const clusterIp = gatewayService.status.loadBalancer.ingress[0].ip;
looks pretty similar to the example you’ve mentioned
b
if you do
kubectl get svc
on the
istio-system
namespace, what is returned?
a
ohh, i see. the trick is it should be `pulumi.interpolate`${gateway.status.namespace}/${gateway.status.name}`
so the
.status
was missing
@billowy-army-68599 thanks a lot for the link
b
ah yeah that’ll do it, the outputs don’t resolve until status is there
glad you got it working!