From d844337d80ffc8a14e7c4e6a72cff0b37c222fc0 Mon Sep 17 00:00:00 2001 From: Darryl Weaver Date: Thu, 6 Oct 2022 10:16:14 +0100 Subject: [PATCH] only quote the double braces --- charts/prometheus/README.md | 7 +++++-- charts/prometheus/templates/dashboards.yaml | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/charts/prometheus/README.md b/charts/prometheus/README.md index 2722da22..4fcdbca6 100644 --- a/charts/prometheus/README.md +++ b/charts/prometheus/README.md @@ -14,11 +14,14 @@ The grafana dashboards include variables to be replaced in Grafana such as: ``` Helm template engine will attempt to interpret these as Helm variables, but we want them passed through without Helm interpreting them. -You can get round this by quoting the variable inside backticks like this: +You can get round this by quoting the variable inside backticks and double curly braces like this: ``` -{{`{{kind}}`}} +{{`{{`}}kind{{`}}`}} ``` +This can be seen used in the upstream kube-prometheus-stack chart here: +- https://github.com/prometheus-community/helm-charts/blob/92a69db2825845e3032a6834dec21e9ec6a5f557/charts/kube-prometheus-stack/templates/grafana/dashboards-1.14/pod-total.yaml#L404 + ## Source Dashboards The source of the dashboards, for flux these are located here: diff --git a/charts/prometheus/templates/dashboards.yaml b/charts/prometheus/templates/dashboards.yaml index fc204893..1dfd9d7d 100644 --- a/charts/prometheus/templates/dashboards.yaml +++ b/charts/prometheus/templates/dashboards.yaml @@ -316,7 +316,7 @@ data: "exemplar": true, "expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"Kustomization|HelmRelease\"}[5m])) by (kind)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"Kustomization|HelmRelease\"}[5m])) by (kind)", "interval": "", - "legendFormat": "{{`{{kind}}`}}", + "legendFormat": "{{`{{`}}kind{{`}}`}}", "refId": "A" } ], @@ -378,7 +378,7 @@ data: "exemplar": true, "expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind)", "interval": "", - "legendFormat": "{{`{{kind}}`}}", + "legendFormat": "{{`{{`}}kind{{`}}`}}", "refId": "A" } ], @@ -704,7 +704,7 @@ data: "expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"Kustomization|HelmRelease\"}[5m])) by (kind, name)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"Kustomization|HelmRelease\"}[5m])) by (kind, name)", "hide": false, "interval": "", - "legendFormat": "{{`{{kind}}/{{name}}`}}", + "legendFormat": "{{`{{`}}kind{{`}}`}}/{{`{{`}}name{{`}}`}}", "refId": "B" } ], @@ -804,7 +804,7 @@ data: "expr": " sum(rate(gotk_reconcile_duration_seconds_sum{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind, name)\n/\n sum(rate(gotk_reconcile_duration_seconds_count{namespace=~\"$operator_namespace\",exported_namespace=~\"$namespace\",kind=~\"GitRepository|HelmRepository|Bucket\"}[5m])) by (kind, name)", "hide": false, "interval": "", - "legendFormat": "{{`{{kind}}/{{name}}`}}", + "legendFormat": "{{`{{`}}kind{{`}}`}}/{{`{{`}}name{{`}}`}}", "refId": "B" } ], @@ -1405,7 +1405,7 @@ data: { "expr": "rate(process_cpu_seconds_total{namespace=\"$namespace\",pod=~\".*-controller-.*\"}[1m])", "interval": "", - "legendFormat": "{{`{{pod}}`}}", + "legendFormat": "{{`{{`}}pod{{`}}`}}", "refId": "A" } ], @@ -1489,7 +1489,7 @@ data: "expr": "rate(go_memstats_alloc_bytes_total{namespace=\"$namespace\",pod=~\".*-controller-.*\"}[1m])", "hide": false, "interval": "", - "legendFormat": "{{`{{pod}}`}}", + "legendFormat": "{{`{{`}}pod{{`}}`}}", "refId": "A" } ],