https://pulumi.com logo
q

quaint-spring-93350

07/17/2023, 12:16 PM
Hi, has anyone figured out how to delete a statefulset and it's PVCs with pulumi?
s

salmon-account-74572

07/17/2023, 3:42 PM
Were the StatefulSet and associated PVCs created using Pulumi?
q

quaint-spring-93350

07/17/2023, 3:42 PM
yep
s

salmon-account-74572

07/17/2023, 3:42 PM
So what happens when you run
pulumi destroy
?
q

quaint-spring-93350

07/17/2023, 3:43 PM
it hangs
I guess it might be a specific case because I have a set of hostName (therefore
storageClassName: "manual"
) PersistentVolumes that then get bound by StatefulSet
via PVCs
so pulumi destroy hangs on trying to remove PVs but kubernetes won't remove them until PVCs exist and PVCs are not deleted due to https://github.com/pulumi/pulumi-kubernetes/issues/218
if I run
kubectl delete pvc --all
in second terminal it continues and cleans up everything correctly
s

salmon-account-74572

07/17/2023, 3:46 PM
Gotcha. Yes, I’d agree with your assessment that this appears to be related to
pulumi-kubernetes#218
. I’m not aware of a workaround, but I’ll ask some engineers internally just in case.
q

quaint-spring-93350

07/17/2023, 3:47 PM
there is an obvious workaround related to manual removal of these PVCs so not a complete blocker 😉
not perfect from the perspective of automating such stuff though 😕
s

salmon-account-74572

07/17/2023, 3:51 PM
Yep, I get it. I’ve asked internally, and I’ll respond here if I get any suggestions. (Or one of our engineers will chime in; a lot of them frequent this Slack community on a regular basis.)
One suggestion to consider: you could use the
pulumi-command
provider to automate some of the cleanup process.
q

quaint-spring-93350

07/18/2023, 6:06 AM
for anyone wondering about that - apparently dropping the whole namespace also works so separating the workload into it's own namespace is one way out too
s

salmon-account-74572

07/18/2023, 3:09 PM
Good to know, thanks!