https://pulumi.com logo
#kubernetes
Title
# kubernetes
b

billions-xylophone-85957

12/15/2023, 8:02 PM
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

dry-keyboard-94795

12/15/2023, 9:13 PM
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

billions-xylophone-85957

12/15/2023, 9:14 PM
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

dry-keyboard-94795

12/15/2023, 9:16 PM
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

billions-xylophone-85957

12/15/2023, 9:16 PM
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

dry-keyboard-94795

12/15/2023, 9:18 PM
For k8s, there's skip-await so that pulumi ignores the finalizers
b

billions-xylophone-85957

12/15/2023, 9:19 PM
won't it skip waiting on
up
as well?
d

dry-keyboard-94795

12/15/2023, 9:19 PM
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

billions-xylophone-85957

12/15/2023, 9:21 PM
how can I upvote a few hundred times?
d

dry-keyboard-94795

12/15/2023, 9:22 PM
Bot accounts. But maybe don't do that
b

billions-xylophone-85957

12/15/2023, 9:22 PM
so you're telling me to write some pulumi to create a few hundred GH accounts and upvote the issue?
sgtm