Helm - change key evaluation in running time

7/5/2021

I am trying to figure out a way to change a key name from 'values-file', in running time.

This is my values-file: values-version.yaml

services:
  - name: service1
  - name: service2
  - name: service3

I call it from template configMap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-confmap
data:
    ### This is the part I am trying to implement:
    ### if 'name of list' == 'services' -> change 'name of list' to services1
    {{- range $service := .Values.services1 }}
    [INPUT]
        Name              tail
        Tag               kube.*
        Path              /var/log/containers/{{ $service1.name }}-*_platform*.log
    {{- end }}

I did not find a way implement it with "sprig" but would like to get any advices. Thanks in advance.

-- jrz
kubernetes
kubernetes-helm

0 Answers