舵图。如何传递带有多个点的 env 值?
Helm Chart. How to pass a env value with multiple dots?
在deployment.yaml中包含条件:
{{- 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 }}
如果我传递 $key = helm install NAME nexus/stand --set env.server.servlet.context-path=/bpm/router-app
,那么我没有得到我期望的结果:
Containers:
...
Environment:
server: map[servlet:map[context-path:/bpm/router-app]]
我怎样才能解决这个问题并获得像这样的环境:
Environment:
server.servlet.context-path: /bpm/router-app
使用双反斜杠。
helm install NAME nexus/stand --set env.server\.servlet\.context-path=/bpm/router-app
这相当于:
env:
server.servlet.context-path: /bpm/router-app
这对注释特别有用。
或者,您应该能够使用引号和单反斜杠。
helm install NAME nexus/stand --set 'env.server\.servlet\.context-path'=/bpm/router-app
在deployment.yaml中包含条件:
{{- 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 }}
如果我传递 $key = helm install NAME nexus/stand --set env.server.servlet.context-path=/bpm/router-app
,那么我没有得到我期望的结果:
Containers:
...
Environment:
server: map[servlet:map[context-path:/bpm/router-app]]
我怎样才能解决这个问题并获得像这样的环境:
Environment:
server.servlet.context-path: /bpm/router-app
使用双反斜杠。
helm install NAME nexus/stand --set env.server\.servlet\.context-path=/bpm/router-app
这相当于:
env:
server.servlet.context-path: /bpm/router-app
这对注释特别有用。
或者,您应该能够使用引号和单反斜杠。
helm install NAME nexus/stand --set 'env.server\.servlet\.context-path'=/bpm/router-app