I have been running in to some odd issues with ArgoCD not updating some of my charts, despite the Git repository having an updated chart version. As it turns out, my configuration and lack of Chart.lock
files seems to have been contributing to this inconsistency.
My GitOps Setup
I have a few repositories that I use as source repositories for Argo. The contain mix of my own resource definition files, which are raw manifest files, and external Helm charts. The external Helm charts use an umbrella chart to allow me the ability to add supporting resources (like secrets). My Grafana chart is a great example of it.
Prior to this, I was not including the Chart.lock
file in the repository. This made it easier to update the version in the Chart.yaml
file without having to run a helm dependency update
to update the lock file. I have been running this setup for at least a year, and I never really noticed much problem until recently. There were a few times where things would not update, but nothing systemic.
And then it got worse
More recently, however, I noticed that the updates weren’t taking. I saw the issue with both the Loki and Grafana charts: The version was updated, but Argo was looking at the old version.
I tried hard refreshes on the Applications in Argo, but nothing seemed to clear that cache. I poked around in the logs and noticed that Argo runs helm dependency build
, not helm dependency update
. That got me thinking “What’s the difference?”
As it turns out, build
operates using the Chart.lock
file if it exists, otherwise it acts like upgrade
. upgrade
uses the Chart.yaml
file to install the latest.
Since I was not committing my Chart.lock
file, it stands to reason that somewhere in Argo there is a cached copy of a Chart.lock
file that was generated by helm dependency build
. Even though my Chart.yaml
was updated, Argo was using the old lock file.
Testing my hypothesis
I committed a lock file 😂! Seriously, I ran helm dependency update
locally to generate a new lock file for my Loki installation and committed it to the repository. And, even though that’s the only file that changed, like magic, Loki determined it needed an update.
So I need to lock it up. But, why? Well, the lock file exists to ensure that subsequent builds use the exact version you specify, similar to npm and yarn. Just like npm and yarn, helm requires a command to be run to update libraries or dependencies.
By not committing my lock file, the possibility exists that I could get a different version than I intended or, even worse, get a spoofed version of my package. The lock file maintains a level of supply chain security.
Now what?
Step 1 is to commit the missing lock files.
At both work and home I have Powershell scripts and pipelines that look for potential updates to external packages and create pull requests to get those updates applied. So step 2 is to alter those scripts to run helm dependency update
when the Chart.yaml
is updated, which will update the Chart.lock
and alleviate the issue.
I am also going to dig into ArgoCD a little bit to see where these generated Chart.lock values could be cached. In testing, the only way around it was to delete the entire ApplicationSet
, so I’m thinking that the ApplicationSet
controller may be hiding some data.