brave-ambulance-98491
03/26/2020, 3:37 PMJob
that I want to guarantee completes before the rest of my stack runs. I feel like the two Pulumi ways to do this are: 1) add a dependsOn
to the rest of the items in the stack, or 2) put the rest of the stack in an `apply`d function off of one of the job's outputs. The first option is a lot of busywork & passing arguments around - but when I did the second, it now produces alarming previews that imply all my Kubernetes objects will be deleted & recreated with each deploy.
I think what I'm looking for doesn't exist: Something like a function on Resource
that looks like:
myResource.andThen(() => { /* stuff that happens only after the resource is created */ });
Does such a function already exist? Is there a pattern to achieve this other than plumbing dependsOn
down the call stack?gorgeous-egg-16927
03/26/2020, 3:40 PMdependsOn
is the answer for now, but you also might want to consider using an initContainer
for tasks like DB migration instead of a Job
brave-ambulance-98491
03/26/2020, 3:43 PMinitContainer
is not a great option. This also would require running the database migrations every time a pod restarted, which I wouldn't like very much. 🙂gorgeous-egg-16927
03/26/2020, 3:44 PMinitContainer
route, you could make the migration script idempotent and add it to all relevant Deployments. So the script would run each time, but would be a no-op if the version already matched (or similar)brave-ambulance-98491
03/26/2020, 3:47 PMResource
means I can run it on its own, if we have a tricky deploy.better-rainbow-14549
03/27/2020, 10:46 AM