pulumi / examples

Infrastructure, containers, and serverless apps to AWS, Azure, GCP, and Kubernetes... all deployed with Pulumi
https://www.pulumi.com
Apache License 2.0
2.36k stars 877 forks source link

Add k8s-ts-wait #1444

Closed mnlumi closed 6 months ago

mnlumi commented 1 year ago

Originating from https://gist.github.com/lukehoban/fd0355ed5b82386bd89c0ffe2a3c916a/

mnlumi commented 1 year ago

Currently stuck on:

    error: Running program './examples/k8s-ts-wait/' failed with an unhandled exception:
    <ref *1> TypeError: Cannot read properties of undefined (reading 'status')
        at ./examples/k8s-ts-wait/index.ts:58:65
        at ./examples/k8s-ts-wait/node_modules/@pulumi/output.ts:398:31
        at Generator.next (<anonymous>)
        at ./examples/k8s-ts-wait/node_modules/@pulumi/pulumi/output.js:21:71
        at new Promise (<anonymous>)
        at __awaiter (./examples/k8s-ts-wait/node_modules/@pulumi/pulumi/output.js:17:12)
        at applyHelperAsync (./examples/k8s-ts-wait/node_modules/@pulumi/pulumi/output.js:239:12)
        at ./examples/k8s-ts-wait/node_modules/@pulumi/output.ts:310:13
        at processTicksAndRejections (node:internal/process/task_queues:95:5) {
      promise: Promise { <rejected> [Circular *1] }
    }
mnlumi commented 1 year ago

Currently stuck on:

    error: Running program './examples/k8s-ts-wait/' failed with an unhandled exception:
    <ref *1> TypeError: Cannot read properties of undefined (reading 'status')
        at ./examples/k8s-ts-wait/index.ts:58:65
        at ./examples/k8s-ts-wait/node_modules/@pulumi/output.ts:398:31
        at Generator.next (<anonymous>)
        at ./examples/k8s-ts-wait/node_modules/@pulumi/pulumi/output.js:21:71
        at new Promise (<anonymous>)
        at __awaiter (./examples/k8s-ts-wait/node_modules/@pulumi/pulumi/output.js:17:12)
        at applyHelperAsync (./examples/k8s-ts-wait/node_modules/@pulumi/pulumi/output.js:239:12)
        at ./examples/k8s-ts-wait/node_modules/@pulumi/output.ts:310:13
        at processTicksAndRejections (node:internal/process/task_queues:95:5) {
      promise: Promise { <rejected> [Circular *1] }
    }

Okay, this is actually expected on preview and runs successfully with pulumi up -f to skip the preview. I'd like to have a better experience on preview if possible.

mnlumi commented 1 year ago

Added an unknown return for preview so that preview will run, but if the code has already run, this will display a pending update on preview. This could be improved further by adding check on preview if jobmetadata already exists, then return that.

pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:dev::k8s-ts-wait::pulumi:pulumi:Stack::k8s-ts-wait-dev]
    ~ kubernetes:batch/v1:Job: (update)
        [id=default/job2-f6810020]
        [urn=urn:pulumi:dev::k8s-ts-wait::kubernetes:batch/v1:Job::job2]
        [provider=urn:pulumi:dev::k8s-ts-wait::pulumi:providers:kubernetes::default_3_29_1::c61304c9-f7bd-4654-9c62-ca84d8db0e1b]
      ~ metadata: {
          ~ annotations: {
              ~ pulumi-waited-on-completion: "2023-06-30T14:05:41Z" => output<string>
            }
        }
mnlumi commented 6 months ago

Closing pull request as this has gone stale.

CC @lukehoban - Just an FYI since we worked on this together last year.