2
votes

I have a configmap which contains a toml file

something like

apiVersion: v1
kind: ConfigMap
data:
  burrow.toml: |
    [zookeeper]
    servers=[abc.2181, cde.2181]
    timeout=6
    root-path="/burrow"

When I am trying to create a helm chart to generate this configmap, I was putting something like:

apiVersion: v1
kind: ConfigMap
data:
  burrow.toml: |
    [zookeeper]
    servers={{ .Values.config.zookeeperServers }}
    timeout=6
    root-path="/burrow"

and in the values.yaml, I put:

  zookeeperServers: [ "abc.2181", "cde.2181"]

However, the rendered value became:

apiVersion: v1
kind: ConfigMap
data:
  burrow.toml: |
    [zookeeper]
    servers=[abc.2181 cde.2181]
    timeout=6
    root-path="/burrow"

The comma is missing. Is there a good way to template this correctly? Thanks!

2

2 Answers

3
votes

Here is one solution, in the values.yaml put

zookeeperServers: |
[ "abc.2181", "cde.2181"]

solves the problem.

3
votes

Try this, servers=[{{ .Values.config.zookeeperServers | join "," }}]. Quoting could get weird if you put TOML metachars in those values, but for simple things it should work.