I've got this (untested) but wondering if there's a more obvious / simpler way
Copy code
await new Promise<boolean>(async (resolve) => {
const webhookStatus = certManager.getResourceProperty("apps/v1/Deployment", "cert-manager/cert-manager-webhook", "status");
const sleep = () => new Promise(resolve => setTimeout(resolve, 1000));
let count = 0;
while (count < 120) {
webhookStatus.availableReplicas.apply(replicas => { if (replicas > 0) resolve(true); });
await sleep();
count++;
}
resolve(false);
});
g
gorgeous-egg-16927
01/21/2020, 2:57 PM
Usually, the solution is to use a liveness/readiness probe defined on the k8s resource itself. With that defined, k8s won’t report the resource ready until the webhook responds, which means Pulumi also won’t report it ready until that happens.
b
better-rainbow-14549
01/22/2020, 10:47 AM
will that work against an admission webhook though? afaict there's no direct link between a resource that a webhook can reject so i'm still not sure how i'd wait to try and deploy it
better-rainbow-14549
01/22/2020, 12:45 PM
i'm also having a problem where my calls to .apply() are being run even during the preview stage which the docs say shouldn't happen. is this a bug?
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.