2 min read | by Jordi Prats
While writing Helm charts we might need to transform some values that are going to be defined as an array as a value into a comma separated string
Let's assume we have the following values defined:
application: defaultRegions: - name: eu-west-1 - name: us-west-1
If we need to tranform this array into a string we can use the join function:
This is an example on how to use it:
(...) apiVersion: v1 kind: Pod metadata: (...) initContainers: - command: - applicacion - config - '--regions' - '{{ join "," .Values.application.defaultRegions }}' env: (...)
It's output would looks like this (we can use helm template or the --dry-run option to render the objects)
(...) apiVersion: v1 kind: Pod metadata: (...) initContainers: - command: - applicacion - config - '--regions' - 'eu-west-1,us-west-1' env: (...)
Posted on 12/11/2021