Skip to content

feat(tracing): Add proxy tracing configuration to control plane helm chart #13994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions charts/linkerd-control-plane/templates/destination.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -447,3 +447,6 @@ spec:
- {{- include "partials.proxy.volumes.service-account-token" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{- if .Values.proxy.tracing.enabled -}}
- {{- include "partials.proxy.volumes.podinfo" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end }}
5 changes: 4 additions & 1 deletion charts/linkerd-control-plane/templates/identity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,11 @@ spec:
{{ if not .Values.cniEnabled -}}
- {{- include "partials.proxyInit.volumes.xtables" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
{{if .Values.identity.serviceAccountTokenProjection -}}
{{ if .Values.identity.serviceAccountTokenProjection -}}
- {{- include "partials.proxy.volumes.service-account-token" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{- if .Values.proxy.tracing.enabled -}}
- {{- include "partials.proxy.volumes.podinfo" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end }}
{{end -}}
3 changes: 3 additions & 0 deletions charts/linkerd-control-plane/templates/proxy-injector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ spec:
- {{- include "partials.proxy.volumes.service-account-token" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end -}}
- {{- include "partials.proxy.volumes.identity" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{if .Values.proxy.tracing.enable -}}
- {{- include "partials.proxy.volumes.podinfo" . | indent 8 | trimPrefix (repeat 7 " ") }}
{{ end }}
---
kind: Service
apiVersion: v1
Expand Down
14 changes: 14 additions & 0 deletions charts/linkerd-control-plane/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,20 @@ proxy:
metrics:
# -- Whether or not to export hostname labels in outbound request metrics.
hostnameLabels: false
# Configures tracing in the proxy and how they are exported
tracing:
# -- Enables trace collection and export in the proxy
enable: false
# -- Protocol to export traces with. Currently supported are
# "opentelemetry" (default) and "opencensus" (deprecated)
protocol: opentelemetry
traceServiceName: linkerd-proxy
collector:
# -- The collector endpoint to send traces to.
endpoint: ""
# -- The identity of the collector in the linkerd mesh. If the collector
# is unmeshed (recommended), this should remain unset.
meshIdentity: ""
inbound:
server:
http2:
Expand Down
22 changes: 22 additions & 0 deletions charts/partials/templates/_proxy.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,24 @@ env:
value: 30s
- name: LINKERD2_PROXY_OUTBOUND_METRICS_HOSTNAME_LABELS
value: {{ .Values.proxy.metrics.hostnameLabels | quote }}
{{- if .Values.proxy.tracing.enable -}}
- name: LINKERD2_PROXY_TRACE_ATTRIBUTES_PATH
value: /var/run/linkerd/podinfo/labels
- name: LINKERD2_PROXY_TRACE_PROTOCOL
value: {{ .Values.proxy.tracing.protocol }}
- name: LINKERD2_PROXY_TRACE_SERVICE_NAME
value: {{ .Values.proxy.tracing.traceServiceName }}
- name: LINKERD2_PROXY_TRACE_COLLECTOR_SVC_ADDR
value: {{ .Values.proxy.tracing.collector.endpoint }}
{{ if .Values.proxy.tracing.collector.meshIdentity -}}
- name: LINKERD2_PROXY_TRACE_COLLECTOR_SVC_NAME
value: {{ .Values.proxy.tracing.collector.meshIdentity }}.serviceaccount.identity.{{.Release.Namespace}}.{{ .Values.clusterDomain }}
{{ end -}}
- name: LINKERD2_PROXY_TRACE_EXTRA_ATTRIBUTES
value: |
k8s.pod.uid=$(_pod_uid)
k8s.container.name=$(_pod_containerName)
{{ end -}}
{{- /* Configure inbound and outbound parameters, e.g. for HTTP/2 servers. */}}
{{ range $proxyK, $proxyV := (dict "inbound" .Values.proxy.inbound "outbound" .Values.proxy.outbound) -}}
{{ range $scopeK, $scopeV := $proxyV -}}
Expand Down Expand Up @@ -284,6 +302,10 @@ lifecycle:
volumeMounts:
- mountPath: /var/run/linkerd/identity/end-entity
name: linkerd-identity-end-entity
{{- if .Values.proxy.tracing.enable }}
- mountPath: /var/run/linkerd/podinfo
name: linkerd-podinfo
{{- end }}
{{- if .Values.identity.serviceAccountTokenProjection }}
- mountPath: /var/run/secrets/tokens
name: linkerd-identity-token
Expand Down
11 changes: 10 additions & 1 deletion charts/partials/templates/_volumes.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ emptyDir:
name: linkerd-identity-end-entity
{{- end -}}

{{- define "partials.proxy.volumes.podinfo" -}}
name: linkerd-podinfo
downwardAPI:
items:
- path: labels
fieldRef:
fieldPath: metadata.labels
{{- end -}}

{{ define "partials.proxyInit.volumes.xtables" -}}
emptyDir: {}
name: {{ .Values.proxyInit.xtMountPath.name }}
Expand Down Expand Up @@ -38,4 +47,4 @@ projected:
apiVersion: v1
fieldPath: metadata.namespace
path: namespace
{{- end -}}
{{- end -}}
19 changes: 19 additions & 0 deletions charts/patch/templates/patch.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ structs.
}
}
},
{{- if .Values.proxy.tracing.enable }}
{
"op": "add",
"path": "{{$prefix}}/spec/volumes/-",
"value": {
"downwardAPI": {
"items": [
{
"fieldRef": {
"fieldPath": "metadata.labels"
},
"path": "labels"
}
]
},
"name": "linkerd-podinfo"
}
},
{{- end }}
{{- if .Values.identity.serviceAccountTokenProjection}}
{
"op": "add",
Expand Down
9 changes: 9 additions & 0 deletions cli/cmd/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ func TestRender(t *testing.T) {
Metrics: &charts.ProxyMetrics{
HostnameLabels: false,
},
Tracing: &charts.ProxyTracing{
Enable: false,
Protocol: "opentelemetry",
TraceServiceName: "linkerd-proxy",
Collector: &charts.ProxyTracingCollector{
Endpoint: "",
MeshIdentity: "",
},
},
LivenessProbe: &charts.Probe{
InitialDelaySeconds: 10,
TimeoutSeconds: 1,
Expand Down
13 changes: 13 additions & 0 deletions cli/cmd/testdata/install_controlplane_tracing_output.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions cli/cmd/testdata/install_custom_domain.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions cli/cmd/testdata/install_custom_registry.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions cli/cmd/testdata/install_default.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading