Parameterize grafana.ini inside a configmap

11/29/2019

I have a grafana dashboard running in a kubernetes cluster which is configured. yaml via a ConfigMap to use Azure AD to restrict access.

I would now like to parameterize the grafana.ini in that configmap so i can use different subdomains in my release pipeline like this:

kind: ConfigMap
data:
  grafana.ini: |
    [server]
    root_url = https://{Subdomain}.domain/
    [...]

{Subdomain} should be replaced in the pipeline via arguments. In a "normal" kubernetes .yaml file I can just do something like

[...]
host: {{ .Values.Subdomain }}.{{ .Values.Domain }}
[...]

to pass in arguments. This seems not to be working in the grafana.ini data section.

What is the correct syntax to pass an argument into the grafana configuration here?

-- myaccforcoding
configmap
grafana
kubernetes
yaml

2 Answers

11/29/2019

You can overwrite INI config file with environment variable like this:

export GF_SERVER_ROOT_URL= https://{Subdomain}.domain/

You can overwrite all of the configuration options with this convention:

GF_<SectionName>_<KeyName>

-- Alireza Davoodi
Source: StackOverflow

11/29/2019

No, there is no string templating in YAML. The examples you are looking at are using Helm to process the YAML. You can do that, but you need actually use Helm for that.

-- coderanger
Source: StackOverflow