If I have a Kubernetes/GKE/AKS/EKS Cluster and Dep...
# general
r
If I have a Kubernetes/GKE/AKS/EKS Cluster and Deploy Resources to it using the Kubernetes Provider/Helm is there a way to when running a Pulumi Destroy to SKIP the deletion of all the Helm/Chart/Release/K8's objects based on the idea the Cluster will be destroyed?
s
I don’t believe there is, but I could be mistaken.
s
you can add delete protection. you can also edit the state to remove the cluster so it's not tracking it
r
Editing the Pulumi state though would be a manual task yes?
s
yes
you could script it though I suppose, it's a CLI command
r
Yeah fair; Although I think delete protection won’t work for me cause the whole stack destroy would error rather than skip protected resources.
s
if you set up depends and parents, you could make it the top-level resource
s
I don’t think adding delete protection would help here, but removing stuff from state (via
pulumi state delete
) might work. I wouldn’t remove the cluster, though (unless I am misunderstanding you, @refined-pilot-45584). I would remove the Helm/Chart/Release/K8s objects, since deleting the cluster will also, necessarily, delete those objects as well. Then a
pulumi destroy
will only delete the cluster and not worry about what’s deployed on the cluster.
r
Yeah I am thinking about the this as the work around. I’m not sure yet how happy I am with it; The reason for doing it is that the cluster components that are deployed generate some unmanaged GCP resources haphazardly. This is by design for the CRDs deployed in the home charts. But it makes it really hard to delete the helm chart deployments. So I think this is the way. Yeah no I would not delete the cluster from the stack; just all deployed resources. And yeah; when the cluster is deleted those helm charts and CRDs are gone and the unmanaged resources. Self heal and delete as they are unmapped bingings I might try this use of a script that only runs on destroy, to remove state, let’s see how it goes.