Commit e21e577
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1089 | 1089 | | |
1090 | 1090 | | |
1091 | 1091 | | |
1092 | | - | |
| 1092 | + | |
1093 | 1093 | | |
1094 | | - | |
| 1094 | + | |
1095 | 1095 | | |
1096 | 1096 | | |
1097 | 1097 | | |
| |||
0 commit comments