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

[Proposal] Multi-step delete #351

Open
robinkb opened this issue Feb 25, 2024 · 4 comments
Open

[Proposal] Multi-step delete #351

robinkb opened this issue Feb 25, 2024 · 4 comments

Comments

@robinkb
Copy link

robinkb commented Feb 25, 2024

Hello!

First of all, thank you for developing Timoni! It's already a wonderful tool, and I hope to see it grow further. On to business.

I am building a Kubernetes cluster using Timoni with Flux. Timoni is used to install Flux, and a set of OCIRepository and Kustomize resources. The OCI artifacts are Kubernetes manifests built with timoni build. The creation of the Kustomize resources is ordered using Timoni's multi-step apply. Components are brought up in an ordered manner without errors.

Unfortunately, tearing down the cluster is not straight-forward. Multi-step delete would make this easier, where resources are deleted in the reverse order defined in the multi-step apply.

If you are open to this suggestion, I could have a crack at developing the feature based on the multi-step apply functionality.

Other solutions that I've checked:

  1. Flux Kustomization's spec.dependsOn. Unfortunately, defined dependencies are not honored during deletion. This applies to the Helm controller as well as the Kustomize controller. These issues are quite old at this point, and it appears to be a complicated problem in Flux because of multi-tenancy reasons.
  2. I see that Bundles do delete instances in reverse. Perhaps I should be using bundles to orchestrate my cluster instead? Even so, I think that multi-step destroy would still be useful to have on the module level.
@stefanprodan
Copy link
Owner

Perhaps I should be using bundles to orchestrate my cluster instead?

Yes that's how I'm managing the Flux AIO setup and the various modules available here: https://timoni.sh/flux-aio/

@robinkb
Copy link
Author

robinkb commented Feb 25, 2024

Thanks for the quick response! I will probably rework my setup to use Bundles then.

What about the proposal though? It might not be the best solution for my particular use-case, but perhaps the feature would be valuable for other situations. If not, I can close the issue.

@stefanprodan
Copy link
Owner

stefanprodan commented Feb 25, 2024

Deletion is done in the reverse order based on kind weight, namespaced first and global last, but it’s done in background without waiting on finalizer. The issue is that whatever is in the module multi-step is not in-cluster, that information is only available at install/upgrade as deletion does not require for the module to exist. Imagine if deletion would fail if the module in the registry would not be available.

@robinkb
Copy link
Author

robinkb commented Feb 26, 2024

Ah yes, that would be a problem. The solution for that would be to persist the multi-step information in-cluster in the Instance Secret.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants