Description
Describe the bug a clear and concise description of what the bug is.
When using an alert variable in the prometheusRule annotations section, I get this output:
COMBINED OUTPUT:
Error: Failed to render chart: exit status 1: Error: template: prometheus-postgres-exporter/templates/prometheusrule.yaml:18:16: executing "prometheus-postgres-exporter/templates/prometheusrule.yaml" at <tpl (toYaml .) $>: error calling tpl: cannot parse template "- alert: PostgreSQLDown\n annotations:\n description: foobar {{ $labels.instance }}\n summary: faa\n expr: pg_up{} != 1\n for: 1m\n labels:\n severity: warning": template: gotpl:3: undefined variable "$labels"
My values.yaml contains this:
prometheusRule:
enabled: true
namespace: {{ .Values.stack.namespace }}
rules:
- alert: PostgreSQLDown
annotations:
description: 'foobar {{`{{ $labels.instance }}`}}'
summary: faa
expr: pg_up{} != 1
for: 1m
labels:
severity: warning
I tried multiple known ways to escape variable expansion but have exhausted my knowledge.
What's your helm version?
version.BuildInfo{Version:"v3.15.3", GitCommit:"3bb50bbbdd9c946ba9989fbe4fb4104766302a64", GitTreeState:"clean", GoVersion:"go1.22.5"}
What's your kubectl version?
Client Version: v1.30.3 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.29.14-eks-bc803b4
Which chart?
prometheus-postgres-exporter
What's the chart version?
6.8.1
What happened?
No response
What you expected to happen?
No response
How to reproduce it?
No response
Enter the changed values of values.yaml?
No response
Enter the command that you execute and failing/misfunctioning.
helm install prometheus-postgres-exporter prometheus-community/prometheus-postgres-exporter --version 6.8.1 --values values.yaml
Anything else we need to know?
A similar thing seems to have happened in the past for the prometheus-blackbox-exporter chart. The solution there was to remove the tpl
function: #2450