Print value of map referenced by pointer

8/7/2019

I am using Helm to render a file. My values to yaml is

team:
  name: abcxyz

I would like to assign the value of team.name to another variable in the values.yaml file. Something like

environmentVariables:
  - TEAM
  - .Values.team.name

So from my research, looks like the above is not possible. But what I do try to use is something like Go pointer. So what Ive tried doing is something like this:

team: &team
  name: abcxyz
environmentVariables:
  - TEAM
  - <<: *team

When I render this, I get the output

        </default>
        <int>1</int>
        <string>TEAM</string>
        <string>map[name:abcxyz]</string>
      </tree-map>

How can I access the value of name through the pointer ?

-- Jason Stanley
go
go-templates
kubernetes-helm
yaml

1 Answer

8/8/2019

I think this is really a YAML question... it seems like you want the alias on the name, not the team collection:

team:
  name: &teamName abcxyz
environmentVariables:
  - TEAM
  - *teamName
-- dahc
Source: StackOverflow