Search code examples
kubernetesgithub-actionskubernetes-helmtraefikrenovate

Helm: How to pin version & make it manageable by Renovate on GitHub


Currently we install Traefik using Helm as described in the docs from it's chart at https://github.com/traefik/traefik-helm-chart. This

... chart bootstraps Traefik version 2 as a Kubernetes ingress controller, using Custom Resources IngressRoute: https://docs.traefik.io/providers/kubernetes-crd/

We do all this right inside our GitHub Actions workflow provision.yml:

      - name: Install Traefik via Helm
        run: |
          echo "--- Install Traefik via Helm (which is already installed in GitHub Actions environment https://github.com/actions/virtual-environments)
          helm repo add traefik https://helm.traefik.io/traefik
          helm repo update
          helm upgrade -i traefik traefik/traefik

Instead of helm install traefik traefik/traefik we use helm upgrade -i traefik traefik/traefik to prevent the error Error: INSTALLATION FAILED: cannot re-use a name that is still in use(see https://stackoverflow.com/a/70465191/4964553).

But now we want to integrate our setup with Renovate. Renovate supports helm, but we don't have a values.yaml file or a Helm chart ourselves - we only use one to install Traefik. So how can we pin the Traefik version and make this repo manageable by Renovate?


Solution

  • Only using --version (as described in this so answer) isn't enough for us, since Renovate needs a dependency file to look at.

    But there's another way to use a simple Chart.yaml to pin our version and have a manageble file for Renovate (here's the Chart.yaml from the example project on GitHub):

    apiVersion: v2
    type: application
    name: traefik
    version: 0.0.0 # unused
    appVersion: 0.0.0 # unused
    dependencies:
      - name: traefik
        repository: https://helm.traefik.io/traefik
        version: 10.19.4
    

    Now with the commands (the . means, that the Chart.yaml is in the same directory as we run our commands):

    helm dependency update .
    helm upgrade -i traefik .
    

    we can now install Traefik in a Renovate-ready way.

    The next time a new Traefik helm chart version got released, Renovate should pick up it's work:

    enter image description here

    Only be sure to add the following to your .gitignore file:

    # Exclude Helm charts lock and packages
    **/**/charts
    **/**/Chart.lock