Skip to content

Commit e21e577

Browse files
authored
fix(argo-cd): fix ArgoAppNotSynced PrometheusRule annotation template syntax (#3853)
The example ArgoAppNotSynced alert annotations used Helm raw-string escaping ({{`{{$labels.name}}`}}) which is not processed by Helm when the PrometheusRule spec is rendered via toYaml. As a result, Prometheus receives the backtick-escaped form literally and evaluates it as a Go template raw-string action, outputting {{$labels.name}} verbatim rather than the actual app name. Alertmanager then receives {{$labels.name}} as an annotation value. Since alertmanager 0.30.0, the default PagerDuty details template uses toJson on the firing alerts and DeepCopyWithTemplate recursively re-renders all strings in the result. This causes alertmanager to fail with "undefined variable $labels" because $labels is Prometheus template syntax, not alertmanager template syntax. Fix by using plain Prometheus template syntax {{ $labels.name }} which passes through toYaml unchanged, is rendered correctly by Prometheus, and reaches alertmanager as a plain string. Also fix an unclosed bracket in the description annotation. Signed-off-by: Vincent Rivellino <github@vince-riv.io>
1 parent c810637 commit e21e577

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

charts/argo-cd/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ appVersion: v3.3.8
33
kubeVersion: ">=1.25.0-0"
44
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.
55
name: argo-cd
6-
version: 9.5.4
6+
version: 9.5.5
77
home: https://github.com/argoproj/argo-helm
88
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
99
sources:
@@ -26,5 +26,5 @@ annotations:
2626
fingerprint: 2B8F22F57260EFA67BE1C5824B11F800CD9D2252
2727
url: https://argoproj.github.io/argo-helm/pgp_keys.asc
2828
artifacthub.io/changes: |
29-
- kind: changed
30-
description: Set argo-cd parent repo as first source in Chart.yaml, so renovate can pull changelogs from parent repo.
29+
- kind: fixed
30+
description: Fix ArgoAppNotSynced PrometheusRule example annotations to use plain Prometheus template syntax instead of Helm raw-string escaping, which caused alertmanager to receive unrendered template expressions.

charts/argo-cd/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,9 +1089,9 @@ controller:
10891089
# labels:
10901090
# severity: warning
10911091
# annotations:
1092-
# summary: "[{{`{{$labels.name}}`}}] Application not synchronized"
1092+
# summary: "[{{ $labels.name }}] Application not synchronized"
10931093
# description: >
1094-
# The application [{{`{{$labels.name}}`}} has not been synchronized for over
1094+
# The application {{ $labels.name }} has not been synchronized for over
10951095
# 12 hours which means that the state of this cloud has drifted away from the
10961096
# state inside Git.
10971097

0 commit comments

Comments
 (0)