DEV Community

K@zuki.
K@zuki.

Posted on • Edited on

Automatically Updating Helm Charts Referenced by Argo CD with Renovate

You can define it more easily in the new article.

Introduction

The manifests repo for my home k8s cluster, home-apps, is managed by Argo CD, and each application creates resources using Helm Charts.

However, it is a hassle to manually update them during updates.

Therefore, I will use Renovate to automate the updates.

Setting up Renovate

You can automatically update applications using Renovate.

Refer to the official documentation to set up Renovate.

You will need to:

  1. Install and configure Renovate's GitHub App
  2. Merge the PR for the added Renovate configuration file

Once installed, you can check it on Renovate's dashboard.

menda renovate

Manifest Configuration

Before moving on to automatic upgrades, let me briefly introduce the configuration of the manifests repo.
Each manifest in the repo is configured as follows.



argocd-config
└── base
    ├── argocd.yaml
    ├── ingress-nginx.yaml
    ├── kustomization.yaml
    ├── metallb.yaml
    └── sealed-secrets.yaml


Enter fullscreen mode Exit fullscreen mode

Each file defines resources using Helm Charts.
The following is an excerpt from argocd.yaml.



---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: argocd
spec:
  ...
  source:
    chart: argo-cd
    repoURL: https://argoproj.github.io/argo-helm
    targetRevision: 5.31.0
    helm:
    ...


Enter fullscreen mode Exit fullscreen mode

Automatic Upgrade

You can use Renovate's regexManagers to upgrade.

I don't like to write regexManagers for each application, so I specify the target repository and the release tag format as follows.



targetRevision: 5.31.0 # renovate: depName=argoproj/argo-helm extractVersion=^argo-cd-(?<version>.+)$


Enter fullscreen mode Exit fullscreen mode
  • Target repository
  • Release tag format

Specify them as Renovate's update targets.

Release Tag Format

Since many Helm Charts managed by each repository have a prefix, the release tag of each repository contains not only the version string specified in targetRevision, but also a prefix.

The format of the release tags for each repository is as follows.

Define regexManagers

Based on this information, define regexManagers.



  "regexManagers": [
    {
      "datasourceTemplate": "github-releases",
      "fileMatch": [
        "argocd-config/base/.*\\.yaml"
      ],
      "matchStrings": [
        " +targetRevision: +(?<currentValue>[^'\" ]+) +# renovate: depName=(?<depName>[^ \\n]+) +(extractVersion=(?<extractVersion>[^\\n]+))?",
      ],
    },
  ]


Enter fullscreen mode Exit fullscreen mode

Simply adding this definition will make the version of the Helm Charts in the manifest automatically updated.

Created PRs

The following PRs were created by the regexManagers defined this time and became as expected.

chore(deps): update dependency kubernetes/ingress-nginx to v4.6.0 #24

Mend Renovate

This PR contains the following updates:

Package Update Change
kubernetes/ingress-nginx minor 4.3.0 -> 4.6.0

Release Notes

kubernetes/ingress-nginx

v4.6.0

Compare Source

Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer

v4.5.2

Compare Source

Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer

v4.5.0

Compare Source

Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer

v4.4.2

Compare Source

Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer

v4.4.0

Compare Source

Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

chore(deps): update dependency bitnami-labs/sealed-secrets to v2.8.2 #23

Mend Renovate

This PR contains the following updates:

Package Update Change
bitnami-labs/sealed-secrets minor 2.7.0 -> 2.8.2

Release Notes

bitnami-labs/sealed-secrets

v2.8.2

Compare Source

Helm chart for the sealed-secrets controller.

v2.8.1

Compare Source

Helm chart for the sealed-secrets controller.

v2.8.0

Compare Source

Helm chart for the sealed-secrets controller.

v2.7.6

Compare Source

Helm chart for the sealed-secrets controller.

v2.7.5

Compare Source

Helm chart for the sealed-secrets controller.

v2.7.4

Compare Source

Helm chart for the sealed-secrets controller.

v2.7.3

Compare Source

Helm chart for the sealed-secrets controller.

v2.7.2

Compare Source

Helm chart for the sealed-secrets controller.

v2.7.1

Compare Source

Helm chart for the sealed-secrets controller.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

chore(deps): update dependency metallb/metallb to v0.13.9 #22

Mend Renovate

This PR contains the following updates:

Package Update Change
metallb/metallb patch 0.13.7 -> 0.13.9

Release Notes

metallb/metallb

v0.13.9

Compare Source

See https://metallb.universe.tf/release-notes/ for details


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

chore(deps): update dependency argoproj/argo-helm to v5.31.1 #21

Mend Renovate

This PR contains the following updates:

Package Update Change
argoproj/argo-helm patch 5.31.0 -> 5.31.1

Release Notes

argoproj/argo-helm

v5.31.1

Compare Source

A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

Conclusion

Those were the steps to automatically update the Argo CD application with Renovate.

You can use this for other things, so please try it out.

Reference

I referred to aqua-renovate-config for the definition of regexManagers.

https://github.com/aquaproj/aqua-renovate-config/blob/2f978289de753b39cb1053dc8ca44e0d6e911640/base.json

GitHub logo aquaproj / aqua-renovate-config

Renovate Configuration to update packages and registries of aqua




Top comments (0)