Home > OS >  Helm Chart. How to pass a env value with multiple dots?
Helm Chart. How to pass a env value with multiple dots?

Time:11-01

In deployment.yaml contains the condition:

          {{- if or $.Values.env $.Values.envSecrets }}
          env:
            {{- range $key, $value := $.Values.env }}
            - name: {{ $key }}
              value: {{ $value | quote }}
            {{- end }}
            {{- range $key, $secret := $.Values.envSecrets }}
            - name: {{ $key }}
              valueFrom:
                secretKeyRef:
                  name: {{ $secret }}
                  key: {{ $key | quote }}
            {{- end }}
          {{- end }}

If I pass the $key = helm install NAME nexus/stand --set env.server.servlet.context-path=/bpm/router-app, then i don't get what i expect:

Containers:

...

    Environment:
      server:   map[servlet:map[context-path:/bpm/router-app]]

How can I get around this problem and get the environment like:

    Environment:
      server.servlet.context-path:   /bpm/router-app

CodePudding user response:

Use double backslashes.

helm install NAME nexus/stand --set env.server\\.servlet\\.context-path=/bpm/router-app

That is the equivalent of:

env:
  server.servlet.context-path: /bpm/router-app

This is useful particularly for annotations.

Alternatively you should be able to use quotes and single backslashes.

helm install NAME nexus/stand --set 'env.server\.servlet\.context-path'=/bpm/router-app
  • Related