DEV Community

Cover image for A cost tab for every Argo CD application
Papapetrou Patroklos
Papapetrou Patroklos

Posted on Edited on

A cost tab for every Argo CD application

After a release, application teams kept asking me if the sync made their application more expensive. Argo CD shows them whether the application is healthy, what changed, and which revision is running, but nothing about cost. The cloud bill comes later and doesn't know about Argo CD applications or syncs, so someone has to work out by hand which change was responsible.

At Octopus Deploy, where I work, we built Cost Intelligence for Argo CD to answer that question. It's an open-source plugin that adds a Cost Intelligence tab to each application in the Argo CD UI, with costs from OpenCost measured after every successful sync.

The Cost Intelligence tab on an application, with the monthly cost, the change since the last sync and the cost breakdown

How it measures an application

Argo CD tracks an application's resources by annotation by default, so there's usually no label on the pods to split costs by application. The plugin uses the list of resources Argo CD sends with the sync notification instead, and counts only the pods of those workloads. If several applications share a namespace, each one shows only its own cost.

Each measurement covers the 24 hours before the sync, so the one taken right after a sync still mostly reflects the previous version. The plugin also records the cost of each application every day, so the Trends view shows the change from the first full day, even without another sync. That history lives in the plugin's own database, so it stays there even after OpenCost's Prometheus no longer has those days.

Try it

You need Argo CD 3.4, 3.5, or 3.6, OpenCost 1.121.1 or newer on the same cluster, and Helm 3.8 or newer. The installation guide covers the Helm install and how to give other roles access to the tab, and it links to a separate guide for when Git manages Argo CD itself. If you don't run OpenCost yet, it also shows how to try the tab with a mock OpenCost.

A few limits, so you know what to expect:

  • It measures only the cluster Argo CD and OpenCost run in.
  • It's an early release, so Helm values and the database schema may still change between minor versions.

There's a longer tour of every view on the Octopus blog, and the code is on GitHub under the Apache 2.0 license.

I'd like to hear what you'd want it to do next, so leave a comment, open an issue, or send a pull request.

Top comments (0)