Kustomizing A Helm Chart With Argocd?

Originally written on 1 December 2021

I often find myself stuck in a situation with a third-party Helm Chart where a particular manifest manipulation has not been exposed by the developers to the values.yaml, which in turn prevents me from installing the application in the way I’d like. Out of the box, Argo CD allows you to deploy from a Helm Chart, flat yaml manifests, or from a Kustomization manifest. However, what you can’t do is take the resulting manifest from a Helm Chart and post-render it through Kustomize to overcome this problem.

Historically, in situations like this, I end up either creating two Argo CD applications to deploy my full set of required manifests, or manually running helm template, and then passing the resulting file through a kustomization.yaml to add my patches as needed. The second option here is definitely not gitops-friendly. The first option is messy and creates an Argo CD application interdependency that I don’t like.

The argocd-lovely-plugin aims to resolve this issue, and provide other lovely additions to your day-to-day gitops workflow.

In this example here, we deploy a third party Helm chart (as defined in the chart directory), a secret (defined in secret) and finally a kustomized configmap (defined in configmap). All of this is controlled through one argocd application, with just two extra lines added to the manifest to tell Argo CD to render the application manifests through the argocd-lovely-plugin:

apiVersion: argoproj.io/v1alpha1
kind: Application
...
spec:
...
  source:
    plugin:
      name: argocd-lovely-plugin

The argocd-lovely-plugin is not just limited to post-rending Helm through Kustomize. You can also:

  • Merge in text file snippets to your Helm or Kustomization output.
  • Apply Kustomization and modify Helm’s values.yaml per application to apply minor differences to your applications trivially when using Argo CD Application Sets.
  • The argocd-lovely-plugin can have its own plugins. In this example, we use the argocd-lovely-plugin to deploy some kustomizations alongside a Helm chart, but also to use the argocd-vault-replacer plugin to pull secrets from Hashicorp Vault and to inject them into the manifests at deploy time. argocd-lovely-plugin acts as a master plugin running (acting as the only plugin to Argo CD), and then runs other Argo CD compatible plugins in a chain. This acts a bit like a unix pipe, so you can helm kustomize argocd-vault-replacer.

Give the argocd-lovely-plugin a go today. Pull requests, issues and feedback are very welcome.