Hello, I am looking into using Pulumi for our Kube...
# general
f
Hello, I am looking into using Pulumi for our Kubernetes infra and wondered if there is a way to run a script when a node/vm resource is being destroyed? The idea is we would drain and cordon nodes before destroying. Then if possible run a command after the destroy to remove the node from kubernetes. Looking at the docs so far I cannot find any logic that can do this and am thinking it would have to be done manually which defeats one of the purposes 😕
w
The best bet for this today is dynamic providers. These provide a way for you to define create,read,update,and delete behaviors for your own kind of resource. If that resource depends on the instance, it will have to be destroyed first, so your custom logic for delete can do whatever it needs to do. See https://www.pulumi.com/blog/dynamic-providers/ and https://www.pulumi.com/docs/intro/concepts/programming-model/#dynamicproviders.
g
f
Do you have any examples of this such as the pre destroy and then post destroy?
Seems like a lot of work where I would think it should be built in.