I'm sort of confused on how in this example the `C...
# general
s
I'm sort of confused on how in this example the
Command
knows only to run when the EKS cluster is being deleted. Is it because
environment
depends on
cluster
? I.e. if the
KUBECONFIG
was a hardcoded string then this
Command
would just never run under any circumstances? https://www.pulumi.com/registry/packages/command/#graceful-cleanup-of-workloads-in-a-kubernetes-cluster What if this Command depends on multiple pulumi resources? Would it run if just one of the resources is being deleted?
l
delete: "kubectl delete --all namespaces",
seems to capture the intention
s
But how does it know only to run that command when the right cluster is deleted?
Actually i think i found the answer in another example:
Note that implicit and explicit (
dependsOn
) dependencies can be used to control the order that these
Command
and
CopyFile
resources are constructed relative to each other and to the cloud resources they depend on. This ensures that the
create
operations run after all dependencies are created, and the
delete
operations run before all dependencies are deleted.
so the Command is only run if all implicit or explicit dependencies fulfill the create/delete/etc event. So if a Command has two dependencies, but only 1 is being deleted, it will not run
l
That's good to know alright, but in that example, there's only one dependency.
When the cluster is deleted, the command has to be deleted first (dependency in
environment
).
s
Yeah. Not knowing what would happen if there are multiple dependencies, for some reason, totally derailed me train of thought. Thanks for helping out 🙂
👍 1