I have a stack with a k8s cluster and a bunch of r...
# kubernetes
b
I have a stack with a k8s cluster and a bunch of resources deployed in there. Let's say I want to destroy it and I don't care if resources are destroyed in the correct order, I'm tearing down the cluster and vpc/project/resource group anyway. Besides, some finalizers are glitchy and I'm really tired of writing bash in local.Commands to deal with it. How can I short-circuit the stack destroy in this case? One way is to delete the k8s provider from the state with --target-dependents, but how can I do it from within the pulumi program?
d
If you're deleting the cluster, you could have any k8s resource set the deletedWith option. However this might cause problems with certain resources from cloud providers, like load balancers or network configs not cleaning up correctly if you don't delete their k8s counterpart explicitly. https://www.pulumi.com/docs/concepts/options/deletedwith/
b
oh nice, didn't know about the
deletedWith
LBs and the like will get deleted together with aws vpc/gcp project/azure resource group
only aws doesn't have cascading deletion
d
I mean implicit ones that are created with the cloud vendor controller. But yeah if you're deleting the gcp project, then gcp will cascade everything correctly
b
same for azure, if deleting a resource group, everything in it gets deleted
i'm fine with `local.Command`ing it, better than cleaning up stuck finalizers %)
d
For k8s, there's skip-await so that pulumi ignores the finalizers
b
won't it skip waiting on
up
as well?
d
Though probably less useful for you now you know about deletedWith
Yes, it ends up skipping for create/updates too
Feel free to up vote this if you think it's a useful feature ;) https://github.com/pulumi/pulumi-kubernetes/issues/2551
b
how can I upvote a few hundred times?
d
Bot accounts. But maybe don't do that
b
so you're telling me to write some pulumi to create a few hundred GH accounts and upvote the issue?
sgtm