https://pulumi.com logo
#typescript
Title
# typescript
a

acoustic-toothbrush-71581

10/18/2019, 5:27 PM
Hi there - I'm new to Pulumi and fairly green with JS/Node promises. I have a deployment via the yaml module for cert manager, currently I'm lead to believe by the docs, that I can load the deployment object for the webhook deployment. My goal is to check the deployment status and wait until it's ready to continue deploying some other things. However when I call
apply()
I seem to get another promise? is this expected I didn't believe it would be. Am I taking the wrong approach here? Is there a better way? Currently we are loading the js kubernetes client and loading a kubeconfig then using it to check the deployment status. However we support at least 3 managed k8s providers and each of the pulumi modules have different ways to obtain the kubeconfig, making this harder. I was hoping to load a client from pulumis modules to check the deployment status.
Copy code
// Deploy cert-manager
 const certmanagerResources = new k8s.yaml.ConfigFile("cmResources", { file: `<https://github.com/jetstack/cert-manager/releasesdownload/${args.version}/cert-manager.yaml>`
 let deployment = certmanagerResources.getResource("apps/v1/Deployment", "cert-manager-webhook")
deployment.apply(k => { k.status ) })` // error status isn't a propery
console.log(Object.getOwnPropertyNames(deployment))
console.log(deployment.apply(k => { Object.getOwnPropertyNames(k) }))
//results in
    [ '__pulumiOutput',
      'isKnown',
      'isSecret',
      'resources',
      'promise',
      'toString',
      'toJSON',
      'apply',
      'get' ]
    OutputImpl {
      __pulumiOutput: true,
      isKnown: Promise { <pending> },
      isSecret: Promise { <pending> },
      resources: [Function],
      promise: [Function],
      toString: [Function],
      toJSON: [Function],
      apply: [Function],
      get: [Function] }
g

gorgeous-egg-16927

10/18/2019, 6:17 PM
Pulumi automatically waits for k8s resources to be ready, so you shouldn’t have to check the status manually. This thread has an example of depending on resources created as part of a helm chart: https://pulumi-community.slack.com/archives/C84L4E3N1/p1571331362260000
a

acoustic-toothbrush-71581

10/18/2019, 6:21 PM
@gorgeous-egg-16927 thanks! I give that a whirl. Also do you know is there a better way to debug things like this. Running pulumi up can take a minute or two between changes
g

gorgeous-egg-16927

10/18/2019, 7:46 PM
I’m not sure I completely understand your question, but I think you might be confused about how to use Input/Output types. https://www.pulumi.com/docs/intro/concepts/programming-model/#outputs should help there. In your specific example, you should be able to do something like:
Copy code
deployment.apply(k => { console.log(Object.getOwnPropertyNames(k)) })
The return value of an
apply
is an Output, but it’s unwrapped/resolved within the function inside of
apply()
3 Views