Skip to content

Commit f5b82f2

Browse files
authored
fix(proxy-injector): handle proxy-log-level with quotes (#13480)
The proxy accepts log filters in the form `target[fields...]=level`, where a field may include a value match. This leads to log filters like `linkerd[name="outbound"]=debug`. When a log filter is configured via annotation or Helm, the proxy-injector fails to properly quote the log environment variable, leading to a failure to patch resources properly. To fix this, this change ensures that the log level is quoted, which properly escapes any quotes in the filter itself.
1 parent 71d15ff commit f5b82f2

File tree

4 files changed

+448
-1
lines changed

4 files changed

+448
-1
lines changed

charts/partials/templates/_proxy.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ env:
3434
- name: LINKERD2_PROXY_SHUTDOWN_ENDPOINT_ENABLED
3535
value: {{.Values.proxy.enableShutdownEndpoint | quote}}
3636
- name: LINKERD2_PROXY_LOG
37-
value: "{{.Values.proxy.logLevel}}{{ if not (eq .Values.proxy.logHTTPHeaders "insecure") }},[{headers}]=off,[{request}]=off{{ end }}"
37+
value: {{ printf "%s%s" .Values.proxy.logLevel (.Values.proxy.logHTTPHeaders | eq "insecure" | ternary "" ",[{headers}]=off,[{request}]=off") | quote }}
3838
- name: LINKERD2_PROXY_LOG_FORMAT
3939
value: {{.Values.proxy.logFormat | quote}}
4040
- name: LINKERD2_PROXY_DESTINATION_SVC_ADDR

controller/proxy-injector/fake/data/pod-inject-enabled-log-level.yaml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)