Commit 1a4d91e
committed
CP-35087: Upgrade Prometheus to 3.x with backward compatibility
Prometheus 3.0 was released and includes performance improvements and new
features. We want to upgrade to the latest stable version (3.7.3) while
maintaining backward compatibility for customers who may be using custom
Prometheus 2.x images.
Impact:
Before: Chart used Prometheus 2.55.1 by default. Prometheus 3.x images would
produce warnings about unknown flag "--enable-feature=agent" since the agent
mode flag changed between versions.
After: Chart uses Prometheus 3.7.3 by default. Both 2.x and 3.x versions work
correctly with automatic flag detection based on image version.
Scope: All customers, but particularly those using custom Prometheus images
via server.image.tag or components.prometheus.image.tag overrides.
Implementation Approach:
Prometheus 3.x changed the agent mode flag from `--enable-feature=agent` to
just `--agent`. To support both versions seamlessly, we needed version-aware
flag selection that respects the same image tag fallback chain used for
actual image generation.
Solution:
1. Updated Chart.AppVersion from v2.55.1 to v3.7.3 in helm/Chart.yaml
2. Created cloudzero-agent.prometheusAgentFlag helper in helm/templates/_helpers.tpl
that:
- Checks if mode is "agent" or "federated" (using existing mode derivation logic)
- Uses same tag fallback as image generation: server.image.tag →
components.prometheus.image.tag → Chart.AppVersion
- Returns "--enable-feature=agent" for v2.x tags
- Returns "--agent" for v3.x and newer tags
- Returns empty string for server/clustered modes
3. Updated helm/templates/agent-deploy.yaml and helm/templates/agent-daemonset.yaml
to use the new helper instead of hardcoded flags
4. Updated helm/tests/agent_mode_derivation_test.yaml to expect "--agent" flag
for default Chart.AppVersion (now 3.7.3)
5. Added comprehensive test suite in helm/tests/prometheus_version_flag_test.yaml
covering:
- Prometheus 2.x uses --enable-feature=agent
- Prometheus 3.x uses --agent
- server.image.tag precedence over components.prometheus.image.tag
- Both agent and federated modes
- Server mode (no agent flag)
- Fallback to Chart.AppVersion
Validation:
- All 255 Helm unit tests pass (added 8 new tests)
- Schema validation tests pass
- Go unit tests pass
- Deployed to brahms cluster successfully
- Verified Prometheus 3.7.3 starts correctly in agent mode with no warnings
- Confirmed all expected metrics (container, node, pod, GPU) flowing correctly
- Zero dropped metrics in production deployment
- Manually tested both v2.x and v3.x tags produce correct flags
- Verified server.image.tag override precedence works correctly1 parent 635a1b3 commit 1a4d91e
File tree
9 files changed
+183
-151
lines changed- helm
- templates
- tests
- tests/helm/template
9 files changed
+183
-151
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1294 | 1294 | | |
1295 | 1295 | | |
1296 | 1296 | | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
0 commit comments