Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete instance workflow/trigger #1046

Closed
pintonunes opened this issue Nov 12, 2019 · 6 comments · Fixed by #1108
Closed

Delete instance workflow/trigger #1046

pintonunes opened this issue Nov 12, 2019 · 6 comments · Fixed by #1108
Assignees
Labels
kind/enhancement user/ops-team user is a ops team that uses kudo
Milestone

Comments

@pintonunes
Copy link

pintonunes commented Nov 12, 2019

Would be great to have a delete workflow that is triggered on the instance delete.
We already have deploy, update, upgrade pre-defined triggers but no delete.

Delete is very useful when you need to perform cleanup tasks before/after deleting the instance.
Ex, A Job that cleans some stuff.
On helm we have lots of hooks that are triggered on specific events. The one I'm missing here is the delete.

@alenkacz
Copy link
Contributor

oh yeah, I like the idea, we've been actually talking about something similar internally, we just call it an uninstall plan.

Just to help us talk about it/prioritize it, could you just briefly explain what kind of logic would you add to the uninstall/delete plan?

By the way, I am sure you know but right now when you remove an instance, all objects owned by that instance (all your resources) are automatically garbage collected and removed as well. But this is also not set in stone, it can be potentially dangerous and we're also discussing if this should stay or go

@pintonunes
Copy link
Author

@alenkacz ,
I think we can start by running a workflow before deleting the CR. Probably its easier for now.
If the workflow is successful, then delete the CR. Dont know if this is feasible cause we send a delete to the k8s api..
Probably we can skip the "if successful" part for the first implementation.

My use case if very simple. We create a database on the deploy workflow.. And we need to delete it on the uninstall/delete of the instance.
So, if I can run a Job when I issue a delete instance will be awesome!!

Right now the workaround is to have like a isDeleted true/false parameter that triggers a workflow that deletes all resources. Then have a CronJob that checks for instances with that parameter set to true and deletes the CR.
Makes sense?

@pintonunes
Copy link
Author

Regarding if you should delete all resources when you remove the instance I think it make perfect sense to delete everything.
Probably we should a some parameter on the operator yaml that can prevent that behavior making the resources orphaned..

@alenkacz
Copy link
Contributor

I think we can start by running a workflow before deleting the CR. Probably its easier for now.
If the workflow is successful, then delete the CR. Dont know if this is feasible cause we send a delete to the k8s api..

This is the current behavior, that is what happens if you do k delete instance name-of-your-instance - that is done by KUDO setting a proper ownership and then relying on finalizers. https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/

if you run the delete in foreground, I think that is exactly the behavior you're gonna get

@pintonunes
Copy link
Author

Great! So running a workflow before deleting the CR will be easier to do right? And that also covers my use case. Cause we can control the deletion order etc etc..
Ex:
Install-> Creates the DB then a webapp
Uninstall -> Deletes the webapp, run some job to clean the DB. After kudo will clean up the remaining resources owned by that instance.
That will be awesome to have!!

@kensipe kensipe added this to the 0.9.0 milestone Nov 19, 2019
@nfnt nfnt added the user/ops-team user is a ops team that uses kudo label Nov 19, 2019
@nfnt nfnt self-assigned this Nov 20, 2019
@nfnt nfnt closed this as completed in #1108 Dec 5, 2019
@pintonunes
Copy link
Author

uauu! Awesome work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement user/ops-team user is a ops team that uses kudo
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants