Render helm charts for an ArgoCD application using Kustomize

argocd kubernetes Application enable-helm

2 min read | by Jordi Prats

We can tell Kustomize to render a helm chart using the --enable-helm flag. In order to render it in the same way using ArgoCD, we'll have to create a plugin that will have this flag.

To create a plugin we'll have to update ArgoCD's argocd-cm ConfigMap, using the configManagementPlugins key. In it we'll define how we want to use kustomize to render the YAML definitions that we want to use. In this case we'll use kustomize build --enable-helm:

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-cm
data:
  configManagementPlugins: |
    - name: kustomize-enable-helm
      generate:
        command: [ "sh", "-c" ]
        args: [ "kustomize build --enable-helm" ]

Then, we'll have to update the key spec.source.plugin.name at the Application, providing the plugin name that we have just defined in the argocd-cm definition:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: app-with-kustomize-enable-helm
spec:
  project: default
  destination:
    server: https://kubernetes.default.svc
(...)
  source:
    plugin:
      name: kustomize-enable-helm
(...)

Posted on 17/01/2023

Categories