01/21/2020, 10:40 AM
can anybody give me a pointer on how to best deploy a yaml.ConfigFile then wait until a particular deployment has replicas ready? i can see how to do it for a pod but that pod's autonamed so not sure how best to query for it. it's for cert-manager and I keep getting an error creating a DNS issuer because the webhook hasnt become ready so I want to try and wait until that's done
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();


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.


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
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?