-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
A way to do something in hook after delete the Argo Application #7575
Comments
Probably not the neatest solution, but a workaround could be using |
@omgapuppy Could you please share a bit more details on how the workaround works? I'd like to have a try before it can be natively supported :-) Thanks!
|
Oh, are you saying that people may do the clean up work in hook in the next round of sync? Should it be the |
Has any more thought been given to this issue? Ideally, when an app is removed from the GitOps repo and subsequently deleted from the cluster by ArgoCD there should be no trace remaining of the app. There are a number of resources that do not clean themselves up properly when they are deleted and would need some additional help. Helm has the post-delete hook for this purpose. A PostSync hook could possibly work but as @omgapuppy points out, you need to add extra logic to determine the context of the sync. Generally, it would be nice if the Hooks had some/any context information available to them (perhaps through injected environment variables) |
@seansund I wonder if the PostSync hook will be triggered when I delete an Argo Application. (i.e.: to uninstall Argo Application). I thought sync hooks are used for something install, not uninstall, right? Another thing that I'm worried about is that, typically happening in a scenario such as operator who has k8 custom resource to be watched. When in uninstall, a delete of Argo Application, might trigger the deletion of the k8 custom resource and the operator at the same time, and in some cases, the operator will be deleted prior to the k8 custom resource, this will lead to the k8 custom resource remained and never be deleted. |
@morningspace I was assuming the PostSync hook would be called at the end of a sync operation, whether create or delete. However, it doesn't look like PostSync hooks are called at all when the application is deleted. On some level it makes sense because there isn't an application anymore for the sync to run against. |
Hi, I'm looking for a way to remove some finalizer in resources after that the operator has been deleted by argocd and didn't got the time to remove it. I can't use helm webhook because I'm using a plugin to apply my app so I tried PostSync et PreSync, and none of the two are working for a deletion... |
@nneram Having the same problem here. I'm really thinking that there needs to be a builtin feature in Argo CD that supports this use case, the deletion of the resources, although I guess it's not something that gets high attention at the moment. |
#9296 (comment) |
I was surprised that none of helm 'delete' hooks are supported, there is a need on my side to do extra clean-up when deleting the app, intentially I was about to create k8s job and execute it automatically if the argocd app is being deleted. |
We are tussling with similar use case but with applicationSets. I am looking for a nice argo driven clean up hook points to run a little clean up for following use cases.
We would treasure a An alternative option is to run extensive github actions pipelines to compute the post delete trigger. This is exhaustive as there are multiple repositories participating in PR generation and kind of takes away the whole simplicity of using argo. Are there any thing we can do to get out of this situation ? |
Similar to what @mohammedshirine is doing, we use Argo to create vClusters via a Helm chart for various environments.
Since Argo does not run the |
In our case, we are trying to manage a service lifecycle by Helm. So it needs to implement in |
Same here, need a way to do cleanup after the app is deleted. Was expecting helm hooks to work, and was very surprised when they didn't. |
Same problem for me with the uninstallation of longhorn. A job needs to be run before deleting the resources (https://github.com/longhorn/charts/blob/master/charts/longhorn/templates/uninstall-job.yaml). This one has a |
Same issue here. It is not great to have to work around the lack of pre/post delete hooks. |
We have a similar use-case where it would be helpful to have a |
Same here - an post delete hook seems a really good fit to the Pull Request Generator to dynamically create and destroy preview environments. |
Same here: can not delete environment database without database CRD solution like CrossPlane. |
This feels out of scope for Argo CD, and precisely why Crossplane et al exist 🤔 |
but why argocd application finalizer can not throw kubernetes job on application delete to call user finish tasks? Or push argo events? Applicationset functional without cleanup logic seems hardly incompleted :( |
We ended up dropping argocd altogether, and this was one of the main reasons. |
Having an issue that would get at least bearable with this capability, an app containing mongodb community operator, deleting the app causes the |
We face the same situation where we would like to run job to delete resource like kafka topic and kafka user if tenant is deleted |
My solution: helm chart with Application without Argo hooks and helm hooks with my jobs. Applicationset without applicationset :) |
I also tried with helm chart with helm hook in the job but it seems job is not running.
|
i'm talking about additional simple helm chart for deploy from inside pipeline: helm release with argo application manifest and helm hooks. Also we can check argo app status with cli: argocd app wait |
thank you for the feedback. Since we would like to not deploy things from gitlab pipeline then that is reason why we move to argocd job. So I think we still need this feature from argocd. Thanks! |
Same here - we are using the Pull Request generator in order to create our dynamic ENVs and we need to create some Kafka topics upon creation and delete them upon deletion of the application, will really help us out. |
We have the same issue that needs to do some cleanup after ephemeral argocd application is deleted |
Summary
It looks there's no way to do some post delete work when I delete an Argo Application, e.g.: to clean up something.
Motivation
For example, I have a set of Kubernetes resources for OLM, including Subscription, certain Custom Resources, etc. that can be synced by Argo CD to deploy on target cluster. During deploying, OLM will auto-generate a resource called ClusterServiceVersion, which will trigger the launch of operator, then operator provision the actual workloads.
When I delete the Argo Application to uninstall the existing deployments. All resources will be dropped on target cluster except the ClusterServiceVersion and the operator, which is not a clean uninstall to me.
Proposal
In such a case, do we have an option that allows customized clean up work defined somewhere such as in a hook, so that I can delete the ClusterServiceVersion resource and the operator inside the hook.
Helm has post-delete hook, but there's no equivalent in Argo CD.
The text was updated successfully, but these errors were encountered: