Skip to content

Commit

Permalink
helm: Use k8s EnvVar for proxy.ExperimentalEnv
Browse files Browse the repository at this point in the history
PR #11874 introduced a `proxy.ExperimentalEnv` setting, allowing
arbitrary name+value environment variables on proxies. This name+value
pairing was a subset of k8s' environment variable, specifically, it did
not allow for `valueFrom.configMapKeyRef` and related fields. PR #11908
introduced this pattern in the ControlPlane containers.

Modify `proxy.ExperimentalEnv` to behave identically to k8s' native
`EnvVar`, allowing settings such as:
```
--set proxy.experimentalEnv[0].name=LINKERD2_PROXY_DEFROBINATION
--set proxy.experimentalEnv[0].valueFrom.configMapKeyRef.key=extreme-key
--set proxy.experimentalEnv[0].valueFrom.configMapKeyRef.name=extreme-config
```

Context:
#11908 (comment)

Signed-off-by: Andrew Seigner <[email protected]>
  • Loading branch information
siggy committed Jan 12, 2024
1 parent f1f5367 commit 169df30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions charts/partials/templates/_proxy.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,8 @@ be used in other contexts.
- name: LINKERD2_PROXY_SHUTDOWN_GRACE_PERIOD
value: {{.Values.proxy.shutdownGracePeriod | quote}}
{{ end -}}
{{ range $k, $v := (.Values.proxy.experimentalEnv) -}}
- name: {{ $k }}
value: {{ $v | quote }}
{{ if .Values.proxy.experimentalEnv -}}
{{ toYaml .Values.proxy.experimentalEnv }}
{{ end -}}
image: {{.Values.proxy.image.name}}:{{.Values.proxy.image.version | default .Values.linkerdVersion}}
imagePullPolicy: {{.Values.proxy.image.pullPolicy | default .Values.imagePullPolicy}}
Expand Down
2 changes: 1 addition & 1 deletion pkg/charts/linkerd2/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ type (
StartupProbe *StartupProbe `json:"startupProbe"`
Control *ProxyControl `json:"control"`

ExperimentalEnv map[string]string `json:"experimentalEnv"`
ExperimentalEnv []corev1.EnvVar `json:"experimentalEnv"`
}

ProxyControl struct {
Expand Down

0 comments on commit 169df30

Please sign in to comment.