2

The process to create an ArgoCD application from an existing helm chart release without downtime is well documented e.g. here:

Just create an application, you can start with auto-sync turned off to see if it picks up on resources etc. The only thing Argo CD should want to do is add an annotation to resources.

That said, even after ArgoCD takes over the existing deployments / services / etc, helm ls still lists the existing release even though it is not directly managed by helm anymore.

What is the recommended way to completely clean up helm for the migrated application, as if it had never been managed by it previously? More specifically:

  • the helm releases (that are now managed by ArgoCD applications), so that they do not show up on helm ls anymore
  • kubernetes object labels and annotations originally added by helm

A more philosophical question to ask is whether the clean up is even necessary. Are these leftover annotations harmless? The main reason I want to clean them up is to avoid / reduce confusion, so that other teammates do not mistakenly think the kubernetes resources are managed by helm.

E.g this is what they look like after ArgoCD "adopts" them:

% kubectl describe svc <my service>
[...]
Labels:            app.kubernetes.io/managed-by=Helm
                   argocd.argoproj.io/instance=<my application name>
                   k8s-addon=ingress-nginx.addons.k8s.io
Annotations:       meta.helm.sh/release-name: <my application name>
                   meta.helm.sh/release-namespace: default
[...]
thiagowfx
  • 145
  • 1
  • 6

1 Answers1

2

You can do this in three steps:

1)Remove the Helm Releases without deleting resources

This can be done by deleting the secrets in which the release is stored. Run:

kubectl get secret | grep helm

Delete all secrets with the form sh.helm.release.v1.myhelm-1572515128.v1 where myhelm is the name of your release.

2)Reduce drift

In Argo CD, look at the diff between your current cluster state and what is to be deployed by Argo CD. Except for annotations and labels related to Argo CD and Helm, decide if you want to keep or revert the difference, change your charts and values accordingly.

3)Synchronize

Finally, synchronize your application. Argo CD labels and annotations will appears. Il you use Helm packages there will still be Helm labels and/or annotations generated when Argo CD run the helm template command.

The potentially problematic part is that the Argo CD application name will be used as the release name of the Helm chart. You can change this by setting the source in the Argo CD application manifest as:

source:
    path: elasticsearch/test
    repoURL: 'https://myrepo.com/helm-config.git'
    targetRevision: HEAD
    helm:
      releaseName: elasticsearch
Ortomala Lokni
  • 212
  • 1
  • 4