Hi folks.
I was wondering if anyone came around something like this. I have an alert in alertmanager which has a Go template like this:
- alert: Critical
annotations:
description: 'Blablabla (pod: ({{$labels.namespace}}/{{$labels.pod}})), it has a current value: {{ $value | humanize }}.'
expr: <whatever>
for: 5m
labels:
severity: '{{- if match "bla-" $labels.namespace }} error {{- else -}} critical {{- end -}}'
category: '{{- if match "bla-" $labels.namespace }} deployment {{- else -}} infrastructure {{- end -}}'
server_id: '{{ if match "bla-" $labels.namespace }} {{ reReplaceAll "bla-(.*)" "$1" $labels.namespace }} {{- else -}} {{- end -}}'
What happens is that the whole thing in severity, category and server_id is just being displayed as is. Like it was just a string and not a Go template. while the templating in description is working perfectly fine.
What's wrong here? Is some kind of config missing from somewhere? Is the syntax incorrect? I did try '{{ `{{...}}` }}' as well, but no cigar.