wise SOers. It turns out Grafana dashboard json files use the same {{ }}
to do variable substitution as helm does. I have a grafana chart that is laden with these {{ }}
to a disagreeable degree.
When I want to put that chart into a template, like so:
apiVersion: v1
kind: ConfigMap
metadata:
name: super-dashboard
namespace: monitoring
labels:
grafana_dashboard: "1"
data:
super-dashboard.json: |-
{{ .Files.Get "super-dashboard.json" | indent 4 }
It works great as long as the super-dashboard.json
doesn't have any thing in it like:
"legendFormat": "{{status}} Status",
.
Unfortunately, our dashboard does have such a woeful line. When I run helm, I get:
Error: UPGRADE FAILED: parse error at (templates/dashboards/super-dashboard.json:282): function "status" not defined
Naturally, it's looking for some method status
which does not exist in the helm template language and fails thusly. If only I could ignore parsing of that pestering file. Oh, ye wise masters of the Internet, have you any sage advice for the humble seeker of your collective wisdom?
.Files.Get
path you should shouldn't cause the included file to be reinterpreted by the templating engine; you would need to explicitly calltpl
for that. Doeshelm template
work on the chart, and if so, does the produced YAML look more or less correct around this block?helm upgrade --install mychart -f ./mychart/values.yaml ./mychart
The json file is in the same directory as the template. (./mychart/template/
)