go template (helm, kubernetes)

10/10/2019
values.yaml
aa:
  bb:
    cc:
      dd: "hi~!!"

In the values ​​file above, the value "cc" is a variable. I'm want to get "hi~!!".

myPod.yaml
apiVersion: v1
...
...
data:
  myData: {{ printf "%s\.dd" $variableKey | index .Values.aa.bb }}

Is this possible?

-- 김태우
kubernetes

1 Answer

10/10/2019

You need two separate args, {{ index .Values.aa.bb $variableKey “dd” }}

-- coderanger
Source: StackOverflow