Kubernetes helm, Files.Get and variables

Somehow i stumbled upon this post and thanks to @david maze, i would like to add few things. So what if there are more than two arguments and the file is in a directory how to use it then. My use-case was to add all the configuration files those were in json into a separate directory named config that was created inside the helm directory. This is how i rolled it out. Hope this helps:

The values.yaml file

config_service_version: v1
config_service_dir: config
service: test

The configmap.yaml file

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Values.service }}-{{ .Values.config_service_version }}
data:
  config.json: |-
    {{ .Files.Get (printf "%s/%s-%s.json" .Values.config_service_dir .Values.service .Values.config_service_version ) | indent 4 }}


The usual way to assemble strings like this is with the Go text/template printf function. One way to do it could be:

{{ printf "%s.krb5.conf" .Values.KRB5_REALM | .Files.Get | indent 4 }}

Or you could parenthesize the expression:

{{ .Files.Get (printf "%s.krb5.conf" .Values.KRB5_REALM) | indent 4 }}