IBM / cp4waiops-gitops

Manage Your IBM Cloud Pak for Watson AIOps With GitOps
https://ibm.github.io/cp4waiops-gitops/docs/
Apache License 2.0
11 stars 27 forks source link

WIP Add delete script task #144

Closed liyanwei93 closed 2 years ago

liyanwei93 commented 2 years ago

Add delete script task:

morningspace commented 2 years ago

More thoughts on the long term solution:

The clean up job is essentially very similar to a regular procedure, so that can be nicely modeled as a pipeline task, which can be triggered either manually or automatically. It's easy to encapsulate the clean up shell script into a Tekton task.

The drawback of the above idea is that it is a one-time off job, which can not be used to regularly monitoring the system for an uninstall need. This goes to 2nd option which is a real Kubernetes controller that has reconciliation logic to keep monitoring the system status. As an example, I think maybe the Crossplane provider ansible is a good choice in this case, because it is working as a controller inside a Kubernetes cluster w/ all the native Kubernetes behavior including the reconciliation, as well as the ability to call Ansible roles and playbooks remotely, e.g.: some shell scripts wrapped as Ansible playbook and hosted in a remote git repo. This can nicely handle our case.

gyliu513 commented 2 years ago

Opened a github issue for argoCD at https://github.com/argoproj/argo-cd/issues/9351 to discuss post uninstall

gyliu513 commented 2 years ago

@morningspace @liyanwei93 as we are using helm chart, can we leverage helm chart hooks for uninstall https://helm.sh/docs/topics/charts_hooks/#writing-a-hook ?

morningspace commented 2 years ago

Some similar discussions here at: https://github.com/argoproj/argo-cd/issues/7575, as I remember, we couldn't rely on helm hook when combing w/ Argo CD, because there's no such mapping between helm hook and Argo CD sync phase for now, which means the hook will not be triggered when we delete Argo application.