https://pulumi.com logo
#kubernetes
Title
# kubernetes
i

icy-jordan-58549

06/25/2020, 4:19 PM
Hi, this code fails with error:
Preview failed: resource operator/kafka-bootstrap-lb does not exist
.
Copy code
export const kafkaService = k8s.core.v1.Service.get(
  "kafkaLB",
  "operator/kafka-bootstrap-lb"
);
const kafkaRecord = new azure.dns.ARecord(
  "kafka",
  {
    name: "kafka",
    zoneName: zone.name,
    resourceGroupName: config.resourceGroup.name,
    ttl: 60,
    records: [kafkaService.status.loadBalancer.ingress[0].ip],
  },
  {
    dependsOn: kafkaService,
  }
);
Service
operator/kafka-bootstrap-lb
isn’t presented in resources (helm), due to operator that deploys this later and looks like
pulumi
doesn’t wait for that service.
g

gorgeous-egg-16927

06/25/2020, 8:39 PM
This looks like the same basic issue as https://github.com/pulumi/pulumi-kubernetes/issues/1056 I think the best workaround for now is to poll for the Service similarly to the example in this comment: https://github.com/pulumi/pulumi-kubernetes/issues/1056#issuecomment-636192266 and then depend on that result instead of using
Service.get
. I thought we had an issue open for retrying within
.get
calls, but I can’t find it now. I’ll open one to track that, since this is something Pulumi should be able to handle natively.
i

icy-jordan-58549

06/25/2020, 9:15 PM
basically, you are saying I can use custom provider or provisioner to fix my issue (https://github.com/pulumi/examples/blob/master/aws-ts-ec2-provisioners/provisioners/provisioner.ts)
g

gorgeous-egg-16927

06/25/2020, 9:20 PM
I don’t think you necessarily have to do something that heavy. You can put polling logic inside a Promise or Output like in this example: https://gist.github.com/timmyers/4d2fed53a358d4c98557a5886ae2afbb
i

icy-jordan-58549

06/25/2020, 11:10 PM
got it. Thanks!
6 Views