Skip to content

Commit da0473f

Browse files
committed
feat(tracing): Add root owner labels to injected pods, V2
This is a roll-forward of #14578, albiet with a slightly different implementation. The original PR would fall back to direct metadata API calls when getting resources from the informer cache. This instead resyncs the informer when a resource cannot be found and tries again, skipping the direct metadata API entirely. Original PR description: Currently, we add a label that identifies the parent resource that a proxy is attached to, usually a deployment, statefulset, daemonset, etc. These are populated via `linkerd.io/proxy-<resource>`` annotations, with a different label for each parent resource. There are a few deficiencies with the current implementation. Currently, the implementation is specialized to only built-in k8s resources, so things like argocd rollouts will not appear. Additionally it does not recurse beyond two levels, so any more levels of parenting will not be captured. This adds a set of new labels, `linkerd.io/proxy-root-parent` and `linkerd.io/proxy-root-parent-kind`, and `linkerd.io/proxy-root-parent-group`, that identify the name and kind of the root parent of a proxy workload. It also correctly recurses to the true root resource, at least as far as cluster role permissions for the proxy injector permit. Note that the proxy already consumes all of the pod labels via the downward API, so there's no changes required to the proxy injector templates. Signed-off-by: Scott Fleener <[email protected]>
1 parent 234c679 commit da0473f

File tree

39 files changed

+437
-78
lines changed

39 files changed

+437
-78
lines changed

cli/cmd/testdata/inject-filepath/expected/injected_nginx.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ spec:
1717
linkerd.io/control-plane-ns: linkerd
1818
linkerd.io/proxy-deployment: nginx
1919
linkerd.io/workload-ns: ""
20+
linkerd.io/proxy-root-parent: nginx
21+
linkerd.io/proxy-root-parent-group: apps
22+
linkerd.io/proxy-root-parent-kind: Deployment
2023
spec:
2124
containers:
2225
- env:

cli/cmd/testdata/inject-filepath/expected/injected_nginx_redis.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ spec:
1616
app: redis
1717
linkerd.io/control-plane-ns: linkerd
1818
linkerd.io/proxy-deployment: redis
19+
linkerd.io/proxy-root-parent: redis
20+
linkerd.io/proxy-root-parent-group: apps
21+
linkerd.io/proxy-root-parent-kind: Deployment
1922
linkerd.io/workload-ns: ""
2023
spec:
2124
containers:
@@ -270,6 +273,9 @@ spec:
270273
app: nginx
271274
linkerd.io/control-plane-ns: linkerd
272275
linkerd.io/proxy-deployment: nginx
276+
linkerd.io/proxy-root-parent: nginx
277+
linkerd.io/proxy-root-parent-group: apps
278+
linkerd.io/proxy-root-parent-kind: Deployment
273279
linkerd.io/workload-ns: ""
274280
spec:
275281
containers:

cli/cmd/testdata/inject-filepath/expected/injected_redis.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ spec:
1717
linkerd.io/control-plane-ns: linkerd
1818
linkerd.io/proxy-deployment: redis
1919
linkerd.io/workload-ns: ""
20+
linkerd.io/proxy-root-parent: redis
21+
linkerd.io/proxy-root-parent-group: apps
22+
linkerd.io/proxy-root-parent-kind: Deployment
2023
spec:
2124
containers:
2225
- env:

cli/cmd/testdata/inject_contour.golden.yml

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

cli/cmd/testdata/inject_emojivoto_already_injected.golden.yml

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

cli/cmd/testdata/inject_emojivoto_deployment.golden.yml

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

cli/cmd/testdata/inject_emojivoto_deployment_access_log.golden.yml

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

cli/cmd/testdata/inject_emojivoto_deployment_automountServiceAccountToken_false.golden.yml

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

cli/cmd/testdata/inject_emojivoto_deployment_capabilities.golden.yml

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

cli/cmd/testdata/inject_emojivoto_deployment_config_overrides.golden.yml

Lines changed: 3 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)