Skip to content

Commit a753088

Browse files
committed
fix(kubevirt-operator): escape Prometheus template variables in PrometheusRule
Helm was trying to evaluate {{ $labels.xxx }} as Helm variables, causing "undefined variable" errors during E2E tests. Wrap Prometheus template expressions in backticks to pass them through Helm unchanged. Signed-off-by: IvanHunters <[email protected]>
1 parent fac0622 commit a753088

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

‎packages/system/kubevirt-operator/templates/prometheusrule.yaml‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ spec:
1717
) == 1
1818
labels:
1919
severity: critical
20-
namespace: "{{ $labels.exported_namespace }}"
20+
namespace: '{{ "{{" }} $labels.exported_namespace {{ "}}" }}'
2121
annotations:
22-
summary: "VM '{{ $labels.name }}' in namespace '{{ $labels.exported_namespace }}' is not Running for more than 10 minutes"
23-
description: >
24-
The VM '{{ $labels.name }}' in namespace '{{ $labels.exported_namespace }}' has been in a non-Running state
25-
for more than 10 minutes. Please investigate the issue.
22+
summary: 'VM {{ "{{" }} $labels.name {{ "}}" }} in namespace {{ "{{" }} $labels.exported_namespace {{ "}}" }} is not Running for more than 10 minutes'
23+
description: 'The VM {{ "{{" }} $labels.name {{ "}}" }} in namespace {{ "{{" }} $labels.exported_namespace {{ "}}" }} has been in a non-Running state for more than 10 minutes. Please investigate the issue.'
2624
- alert: VMINotRunningFor10Minutes
2725
expr: |
2826
max_over_time(
@@ -34,9 +32,7 @@ spec:
3432
) == 1
3533
labels:
3634
severity: critical
37-
namespace: "{{ $labels.exported_namespace }}"
35+
namespace: '{{ "{{" }} $labels.exported_namespace {{ "}}" }}'
3836
annotations:
39-
summary: "VMI '{{ $labels.name }}' in namespace '{{ $labels.exported_namespace }}' is not Running for more than 10 minutes"
40-
description: >
41-
The VM '{{ $labels.name }}' in namespace '{{ $labels.exported_namespace }}' has been in a non-Running state
42-
for more than 10 minutes. Please investigate the issue.
37+
summary: 'VMI {{ "{{" }} $labels.name {{ "}}" }} in namespace {{ "{{" }} $labels.exported_namespace {{ "}}" }} is not Running for more than 10 minutes'
38+
description: 'The VMI {{ "{{" }} $labels.name {{ "}}" }} in namespace {{ "{{" }} $labels.exported_namespace {{ "}}" }} has been in a non-Running state for more than 10 minutes. Please investigate the issue.'

0 commit comments

Comments
 (0)