Convert dictionary in Helm chart template

Viewed 108

I want to convert dictionary to dictionary (Variable) in Helm chart, not related to the Template rendering

# Values.yaml
proxy:
  public:
    alias: proxy-public.somedomain.com
    address: 123.123.123.123
  private:
    alias: proxy-private.somedomain.com
    address: 172.25.8.16

I want to convert to another dictionary, dict comprehension/jq/Terraform style:

{{- $aliases := ... ???? -}}

So structure is,

{public: proxy-"public.somedomain.com", private: "proxy-private.somedomain.com"}

Having hard time making proper syntax

Purpose is, to have this dictionary converted to Json down the line

data:
  aliases: {{ $aliases | toJson | quote }}

Which is different from looping and rendering it to the template, like in this SO anwer, for example:

0 Answers
Related