Renovate your GitOps
Every engineering organization struggles to stay up to date with the latest versions of applications they run.
When an organization deploys an open source project, their versions start to drift from day one.
The longer a project runs without an update, the more likely it is to contain a vulnerability.
To help applications stay on top of library versions, the project Renovate was developed.
Renovate works by parsing manifest files (like
go.mod) and checking for newer versions of libraries.
When Renovate discovers an update, it submits a pull request with the newer version to the project.
Recently, I noticed Renovate submit pull requests for dependencies in my Helm v3 charts. This gave me an idea. What if Renovate could automatically manage something like a GitOps repository? This means organizations would no longer need to tediously query for newer versions of applications. Instead, they’d automatically receive a pull request when an update becomes available. In this blog post, I demonstrate how to set this up for an ArgoCD GitOps repository.
What is GitOps?
GitOps is the process of managing infrastructure using
git and pull requests.
It enables developers to manage their infrastructure and applications with a declarative source of truth.
Because workloads must be declared, it provides transparency around what versions of applications are running.
Recently, GitOps has become more popular within the Kubernetes community. We’ve seen new tooling to support GitOps like FluxCD, ArgoCD, and GitOps toolkit. While it GitOps has solved many problems for organizations, it’s also led to some challenges. As our ability to deploy and manage software has become easier, we’ve also increased the number of things we need to manage. Staying on top of all the recent versions of these systems can sometimes feel like a full time job.
ArgoCD is an incubating project in the Cloud Native Computing Foundation (CNCF). It enables declarative delivery of workloads to Kubernetes through GitOps. One of the nice things about ArgoCDs Application model is that it lets you point at Helm charts stored in git. This is convenient because Renovate can identify these charts and manage the versions of dependencies within them.
As a result, we have an automated cycle that self-manages.
ArgoCD will roll out any changes whenever someone merges something into your default branch (
Renovate will periodically open pull requests with newer versions of dependent applications as they become available.
Once an engineer merges that pull request, the changes propagate out via ArgoCD.
Here we go!
Before setting up a project, here are a few things you’ll need:
- Some version control system (VCS) like GitHub, GitLab, and BitBucket. I’m using GitHub, but you can download a zip and pull it into your VCS of choice. For simplicity, this repository should be public. This makes the ArgoCD side of the world a bit easier.
- A personal access token to your VCS for Renovate to use.
- Docker - A popular container runtime.
- kind - We will be spinning up a cluster in docker for this demonstration.
- Helm v3 - Used to perform the initial deployment of ArgoCD.
To help reduce the setup, I created a template on GitHub. You can either fork the template, or use it to create your own project and follow along.
With your newly created project, you’ll need to replace references to the source.
You can find these references by executing
git grep within the project root.
Note: If you’re not using GitHub, you’ll need to change your platform in Renovate’s configuration.
Once replaced, be sure to commit and push your changes. ArgoCD deploys code from the remote repository, not from your local copy.
Next, we’ll deploy a local kind cluster.
At this point, you’ll want to give kind a minute or two to initialize.
Kind runs the control plane components inside the cluster, so it takes a minute for things to come up.
You can watch the pods come up in the
Once initialized, we can deploy ArgoCD.
The last command above will hang until the
argocd-server has successfully been deployed.
Once released, you can try logging into ArgoCD using
admin for the username and
password for the password.
To do this, you’ll need to forward the port for the service before opening
localhost:8080 in the browser.
Next, we’re going to create a root ArgoCD Application named
This is used to bootstrap all the other applications running in the cluster.
In the end, there should be a total of 5 applications (
Once all five applications are there, you should be able to watch the pods come up. You can do this either in the ArgoCD UI (from earlier) or by getting pods for all namespaces.
In order for Renovate to run, it needs a secret.
The secret should contain any sensitive configuration for renovate.
For GitHub or GitLab, you just need to provide an access token (
For BitBucket, you will also need to include a username (
Now, we just need to kick off a job for Renovate.
When the job completes, you should wind up with a few pull requests. You can see some examples under the pull requests tab.
Once we merge one of these pull requests, ArgoCD will kick off a deployment. It might take a minute or two for ArgoCD to realize there are changes. If time is of the essence, you can always go into the UI and force refresh the application. In production deployments, you might consider configuring a hook that runs a sync in your CI job.
Together, these technologies reduce the burden of running software yourself. It can free up time for your developers, allowing them to focus on valuable work for your company. With proper testing, you can configure Renovate to automatically merge changes if they pass your checks.
I’ve been using this configuration for my projects, and it’s been working out great. I hope others find this as useful as I have. Enjoy!