From cc106815ca2a9ec2f003f2271348301a7a26f6f7 Mon Sep 17 00:00:00 2001 From: Alex Leong Date: Tue, 24 Oct 2023 19:17:44 +0000 Subject: [PATCH] Add pod name to context token and logging Signed-off-by: Alex Leong --- charts/partials/templates/_proxy.tpl | 2 +- .../expected/injected_nginx.yaml | 2 +- .../expected/injected_nginx_redis.yaml | 4 +- .../expected/injected_redis.yaml | 2 +- cli/cmd/testdata/inject_contour.golden.yml | 2 +- ...ject_emojivoto_already_injected.golden.yml | 8 +-- .../inject_emojivoto_deployment.golden.yml | 2 +- ...emojivoto_deployment_access_log.golden.yml | 2 +- ...omountServiceAccountToken_false.golden.yml | 2 +- ...ojivoto_deployment_capabilities.golden.yml | 2 +- ...oto_deployment_config_overrides.golden.yml | 2 +- ...voto_deployment_controller_name.golden.yml | 4 +- ...ject_emojivoto_deployment_debug.golden.yml | 2 +- ...voto_deployment_empty_resources.golden.yml | 2 +- ...to_deployment_hostNetwork_false.golden.yml | 2 +- ...to_deployment_no_init_container.golden.yml | 2 +- ...ojivoto_deployment_opaque_ports.golden.yml | 2 +- ...emojivoto_deployment_overridden.golden.yml | 2 +- ...ojivoto_deployment_proxyignores.golden.yml | 2 +- ...inject_emojivoto_deployment_udp.golden.yml | 2 +- .../testdata/inject_emojivoto_list.golden.yml | 4 +- ..._emojivoto_list_empty_resources.golden.yml | 4 +- .../testdata/inject_emojivoto_pod.golden.yml | 2 +- .../inject_emojivoto_pod_ingress.golden.yml | 2 +- ...ject_emojivoto_pod_proxyignores.golden.yml | 2 +- ...ect_emojivoto_pod_with_requests.golden.yml | 2 +- .../inject_emojivoto_statefulset.golden.yml | 2 +- .../inject_gettest_deployment.good.golden.yml | 4 +- .../inject_tap_deployment_debug.golden.yml | 2 +- ...install_controlplane_tracing_output.golden | 6 +- cli/cmd/testdata/install_custom_domain.golden | 6 +- .../testdata/install_custom_registry.golden | 6 +- cli/cmd/testdata/install_default.golden | 6 +- ...stall_default_override_dst_get_nets.golden | 6 +- cli/cmd/testdata/install_default_token.golden | 6 +- cli/cmd/testdata/install_ha_output.golden | 6 +- .../install_ha_with_overrides_output.golden | 6 +- .../install_heartbeat_disabled_output.golden | 6 +- .../install_helm_control_plane_output.golden | 6 +- ...nstall_helm_control_plane_output_ha.golden | 6 +- .../install_helm_output_ha_labels.golden | 6 +- ...l_helm_output_ha_namespace_selector.golden | 6 +- .../testdata/install_no_init_container.golden | 6 +- cli/cmd/testdata/install_output.golden | 6 +- cli/cmd/testdata/install_proxy_ignores.golden | 6 +- cli/cmd/testdata/install_values_file.golden | 6 +- .../endpoint_profile_translator.go | 5 +- controller/api/destination/server.go | 58 ++++++++++++------- .../fake/data/pod-with-debug.patch.json | 6 +- .../data/pod-with-ns-annotations.patch.json | 6 +- .../proxy-injector/fake/data/pod.patch.json | 6 +- 51 files changed, 138 insertions(+), 119 deletions(-) diff --git a/charts/partials/templates/_proxy.tpl b/charts/partials/templates/_proxy.tpl index 1f644894b9308..c70c149005459 100644 --- a/charts/partials/templates/_proxy.tpl +++ b/charts/partials/templates/_proxy.tpl @@ -92,7 +92,7 @@ env: {{ end -}} - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject-filepath/expected/injected_nginx.yaml b/cli/cmd/testdata/inject-filepath/expected/injected_nginx.yaml index ee619c20a066a..a035e8a45f1fd 100644 --- a/cli/cmd/testdata/inject-filepath/expected/injected_nginx.yaml +++ b/cli/cmd/testdata/inject-filepath/expected/injected_nginx.yaml @@ -80,7 +80,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject-filepath/expected/injected_nginx_redis.yaml b/cli/cmd/testdata/inject-filepath/expected/injected_nginx_redis.yaml index 0af6c1d59fc21..2202a79c4b3c1 100644 --- a/cli/cmd/testdata/inject-filepath/expected/injected_nginx_redis.yaml +++ b/cli/cmd/testdata/inject-filepath/expected/injected_nginx_redis.yaml @@ -80,7 +80,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -294,7 +294,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject-filepath/expected/injected_redis.yaml b/cli/cmd/testdata/inject-filepath/expected/injected_redis.yaml index 928046ed3ebe8..7da2ca85f5d2f 100644 --- a/cli/cmd/testdata/inject-filepath/expected/injected_redis.yaml +++ b/cli/cmd/testdata/inject-filepath/expected/injected_redis.yaml @@ -80,7 +80,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_contour.golden.yml b/cli/cmd/testdata/inject_contour.golden.yml index a9ff22f2e1fa0..f8144419e3ee3 100644 --- a/cli/cmd/testdata/inject_contour.golden.yml +++ b/cli/cmd/testdata/inject_contour.golden.yml @@ -88,7 +88,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_already_injected.golden.yml b/cli/cmd/testdata/inject_emojivoto_already_injected.golden.yml index 1901cc986a1d2..3f4085bd42575 100644 --- a/cli/cmd/testdata/inject_emojivoto_already_injected.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_already_injected.golden.yml @@ -82,7 +82,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -307,7 +307,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -532,7 +532,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -757,7 +757,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment.golden.yml index e945992aecd4f..0733e684aea19 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment.golden.yml @@ -82,7 +82,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_access_log.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_access_log.golden.yml index c7217841315bf..b3904a4c9e139 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_access_log.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_access_log.golden.yml @@ -83,7 +83,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_automountServiceAccountToken_false.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_automountServiceAccountToken_false.golden.yml index 8c7a14c9d2269..4469e39273153 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_automountServiceAccountToken_false.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_automountServiceAccountToken_false.golden.yml @@ -83,7 +83,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_capabilities.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_capabilities.golden.yml index 4cbc27af336c8..6c4417e1f3f44 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_capabilities.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_capabilities.golden.yml @@ -82,7 +82,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_config_overrides.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_config_overrides.golden.yml index efdbce80e7bde..d159bc91db81e 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_config_overrides.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_config_overrides.golden.yml @@ -92,7 +92,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_controller_name.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_controller_name.golden.yml index 5b8ee7724e8f8..a13909723583e 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_controller_name.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_controller_name.golden.yml @@ -82,7 +82,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -307,7 +307,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_debug.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_debug.golden.yml index 0342e61a7558a..b84740dcad488 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_debug.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_debug.golden.yml @@ -83,7 +83,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_empty_resources.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_empty_resources.golden.yml index 75cc47819729f..c23e17076bab5 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_empty_resources.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_empty_resources.golden.yml @@ -82,7 +82,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_hostNetwork_false.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_hostNetwork_false.golden.yml index 9440a525f4ea4..03dfa74d1df6c 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_hostNetwork_false.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_hostNetwork_false.golden.yml @@ -82,7 +82,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_no_init_container.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_no_init_container.golden.yml index ad0a3909d20fe..54097aa8891fe 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_no_init_container.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_no_init_container.golden.yml @@ -82,7 +82,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_opaque_ports.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_opaque_ports.golden.yml index 7b013cf1f101e..ff17eb4d92c75 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_opaque_ports.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_opaque_ports.golden.yml @@ -83,7 +83,7 @@ spec: value: 3000,5000-6000,mysql - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_overridden.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_overridden.golden.yml index 42837477f367a..22e3edaa69fa0 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_overridden.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_overridden.golden.yml @@ -83,7 +83,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_proxyignores.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_proxyignores.golden.yml index 4e7652394546d..c0c8e0ec57fde 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_proxyignores.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_proxyignores.golden.yml @@ -84,7 +84,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_deployment_udp.golden.yml b/cli/cmd/testdata/inject_emojivoto_deployment_udp.golden.yml index 54d223df114e4..699d96513c400 100644 --- a/cli/cmd/testdata/inject_emojivoto_deployment_udp.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_deployment_udp.golden.yml @@ -82,7 +82,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_list.golden.yml b/cli/cmd/testdata/inject_emojivoto_list.golden.yml index 5ec154d408cea..6bb7c4dbbf272 100644 --- a/cli/cmd/testdata/inject_emojivoto_list.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_list.golden.yml @@ -84,7 +84,7 @@ items: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -308,7 +308,7 @@ items: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_list_empty_resources.golden.yml b/cli/cmd/testdata/inject_emojivoto_list_empty_resources.golden.yml index 2ad6ff704ef3c..8667ce0c48157 100644 --- a/cli/cmd/testdata/inject_emojivoto_list_empty_resources.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_list_empty_resources.golden.yml @@ -84,7 +84,7 @@ items: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -308,7 +308,7 @@ items: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_pod.golden.yml b/cli/cmd/testdata/inject_emojivoto_pod.golden.yml index 8333a4fa1f87a..9a16bade90643 100644 --- a/cli/cmd/testdata/inject_emojivoto_pod.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_pod.golden.yml @@ -73,7 +73,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_pod_ingress.golden.yml b/cli/cmd/testdata/inject_emojivoto_pod_ingress.golden.yml index a63a395152ffa..618d5e1d898bf 100644 --- a/cli/cmd/testdata/inject_emojivoto_pod_ingress.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_pod_ingress.golden.yml @@ -76,7 +76,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_pod_proxyignores.golden.yml b/cli/cmd/testdata/inject_emojivoto_pod_proxyignores.golden.yml index 5d574dfcc4ca6..182c240b42b8e 100644 --- a/cli/cmd/testdata/inject_emojivoto_pod_proxyignores.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_pod_proxyignores.golden.yml @@ -75,7 +75,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_pod_with_requests.golden.yml b/cli/cmd/testdata/inject_emojivoto_pod_with_requests.golden.yml index ceb4898c97cb2..c9ebe123ff3a8 100644 --- a/cli/cmd/testdata/inject_emojivoto_pod_with_requests.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_pod_with_requests.golden.yml @@ -77,7 +77,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_emojivoto_statefulset.golden.yml b/cli/cmd/testdata/inject_emojivoto_statefulset.golden.yml index 0fa476c296db5..f789363fde9cd 100644 --- a/cli/cmd/testdata/inject_emojivoto_statefulset.golden.yml +++ b/cli/cmd/testdata/inject_emojivoto_statefulset.golden.yml @@ -83,7 +83,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_gettest_deployment.good.golden.yml b/cli/cmd/testdata/inject_gettest_deployment.good.golden.yml index 0b474ee7aa6aa..45f17705766a7 100644 --- a/cli/cmd/testdata/inject_gettest_deployment.good.golden.yml +++ b/cli/cmd/testdata/inject_gettest_deployment.good.golden.yml @@ -78,7 +78,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -305,7 +305,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/inject_tap_deployment_debug.golden.yml b/cli/cmd/testdata/inject_tap_deployment_debug.golden.yml index b696f8918ffb8..bd88527ee6d27 100644 --- a/cli/cmd/testdata/inject_tap_deployment_debug.golden.yml +++ b/cli/cmd/testdata/inject_tap_deployment_debug.golden.yml @@ -99,7 +99,7 @@ spec: value: 25,587,3306,4444,5432,6379,9300,11211 - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_controlplane_tracing_output.golden b/cli/cmd/testdata/install_controlplane_tracing_output.golden index e904bf56fd485..eb91581431e2f 100644 --- a/cli/cmd/testdata/install_controlplane_tracing_output.golden +++ b/cli/cmd/testdata/install_controlplane_tracing_output.golden @@ -957,7 +957,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1284,7 +1284,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1711,7 +1711,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_custom_domain.golden b/cli/cmd/testdata/install_custom_domain.golden index 114085c313b91..932d47dd1886e 100644 --- a/cli/cmd/testdata/install_custom_domain.golden +++ b/cli/cmd/testdata/install_custom_domain.golden @@ -956,7 +956,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1283,7 +1283,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1709,7 +1709,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_custom_registry.golden b/cli/cmd/testdata/install_custom_registry.golden index ae1fbef6d9b21..d00e1765dda60 100644 --- a/cli/cmd/testdata/install_custom_registry.golden +++ b/cli/cmd/testdata/install_custom_registry.golden @@ -956,7 +956,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1283,7 +1283,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1709,7 +1709,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_default.golden b/cli/cmd/testdata/install_default.golden index 114085c313b91..932d47dd1886e 100644 --- a/cli/cmd/testdata/install_default.golden +++ b/cli/cmd/testdata/install_default.golden @@ -956,7 +956,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1283,7 +1283,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1709,7 +1709,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_default_override_dst_get_nets.golden b/cli/cmd/testdata/install_default_override_dst_get_nets.golden index 4f7d34d33dc05..7bb1e47358b42 100644 --- a/cli/cmd/testdata/install_default_override_dst_get_nets.golden +++ b/cli/cmd/testdata/install_default_override_dst_get_nets.golden @@ -956,7 +956,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1283,7 +1283,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1709,7 +1709,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_default_token.golden b/cli/cmd/testdata/install_default_token.golden index 956d3a7b0d243..d178d3c74466a 100644 --- a/cli/cmd/testdata/install_default_token.golden +++ b/cli/cmd/testdata/install_default_token.golden @@ -956,7 +956,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1274,7 +1274,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1691,7 +1691,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_ha_output.golden b/cli/cmd/testdata/install_ha_output.golden index 05d5afe2b6848..c29b95442eb44 100644 --- a/cli/cmd/testdata/install_ha_output.golden +++ b/cli/cmd/testdata/install_ha_output.golden @@ -1033,7 +1033,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1400,7 +1400,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1862,7 +1862,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_ha_with_overrides_output.golden b/cli/cmd/testdata/install_ha_with_overrides_output.golden index c77874625ff67..624b167c810e2 100644 --- a/cli/cmd/testdata/install_ha_with_overrides_output.golden +++ b/cli/cmd/testdata/install_ha_with_overrides_output.golden @@ -1033,7 +1033,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1400,7 +1400,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1862,7 +1862,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_heartbeat_disabled_output.golden b/cli/cmd/testdata/install_heartbeat_disabled_output.golden index 2869e266883c5..9a13ca6c21091 100644 --- a/cli/cmd/testdata/install_heartbeat_disabled_output.golden +++ b/cli/cmd/testdata/install_heartbeat_disabled_output.golden @@ -887,7 +887,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1214,7 +1214,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1580,7 +1580,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_helm_control_plane_output.golden b/cli/cmd/testdata/install_helm_control_plane_output.golden index e3c7893fbc4cf..8cead0b7bf167 100644 --- a/cli/cmd/testdata/install_helm_control_plane_output.golden +++ b/cli/cmd/testdata/install_helm_control_plane_output.golden @@ -929,7 +929,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1258,7 +1258,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1688,7 +1688,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_helm_control_plane_output_ha.golden b/cli/cmd/testdata/install_helm_control_plane_output_ha.golden index e1c64ec0dc5f9..b3b1672d81eb8 100644 --- a/cli/cmd/testdata/install_helm_control_plane_output_ha.golden +++ b/cli/cmd/testdata/install_helm_control_plane_output_ha.golden @@ -1006,7 +1006,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1375,7 +1375,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1841,7 +1841,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_helm_output_ha_labels.golden b/cli/cmd/testdata/install_helm_output_ha_labels.golden index 6a4a23d20638c..6a5fdc1a6a386 100644 --- a/cli/cmd/testdata/install_helm_output_ha_labels.golden +++ b/cli/cmd/testdata/install_helm_output_ha_labels.golden @@ -1014,7 +1014,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1387,7 +1387,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1861,7 +1861,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_helm_output_ha_namespace_selector.golden b/cli/cmd/testdata/install_helm_output_ha_namespace_selector.golden index 7ee60963c2a08..f593efacec404 100644 --- a/cli/cmd/testdata/install_helm_output_ha_namespace_selector.golden +++ b/cli/cmd/testdata/install_helm_output_ha_namespace_selector.golden @@ -996,7 +996,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1365,7 +1365,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1831,7 +1831,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_no_init_container.golden b/cli/cmd/testdata/install_no_init_container.golden index e05c098d7f5dc..5f4380817f32c 100644 --- a/cli/cmd/testdata/install_no_init_container.golden +++ b/cli/cmd/testdata/install_no_init_container.golden @@ -956,7 +956,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1277,7 +1277,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1697,7 +1697,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_output.golden b/cli/cmd/testdata/install_output.golden index 9b3d4a0428acf..f35f19ca9a576 100644 --- a/cli/cmd/testdata/install_output.golden +++ b/cli/cmd/testdata/install_output.golden @@ -928,7 +928,7 @@ spec: value: "25,443,587,3306,5432,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1252,7 +1252,7 @@ spec: value: "25,443,587,3306,5432,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1682,7 +1682,7 @@ spec: value: "25,443,587,3306,5432,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_proxy_ignores.golden b/cli/cmd/testdata/install_proxy_ignores.golden index 1f26400ad54e2..9f07dfed6ddf9 100644 --- a/cli/cmd/testdata/install_proxy_ignores.golden +++ b/cli/cmd/testdata/install_proxy_ignores.golden @@ -956,7 +956,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1283,7 +1283,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1709,7 +1709,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/cli/cmd/testdata/install_values_file.golden b/cli/cmd/testdata/install_values_file.golden index 4a3598760c734..3a1fefc410c5b 100644 --- a/cli/cmd/testdata/install_values_file.golden +++ b/cli/cmd/testdata/install_values_file.golden @@ -956,7 +956,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1283,7 +1283,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: @@ -1709,7 +1709,7 @@ spec: value: "25,587,3306,4444,5432,6379,9300,11211" - name: LINKERD2_PROXY_DESTINATION_CONTEXT value: | - {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)"} + {"ns":"$(_pod_ns)", "nodeName":"$(_pod_nodeName)", "pod":"$(_pod_name)"} - name: _pod_sa valueFrom: fieldRef: diff --git a/controller/api/destination/endpoint_profile_translator.go b/controller/api/destination/endpoint_profile_translator.go index 59af170b6c542..85c7f45bf7f33 100644 --- a/controller/api/destination/endpoint_profile_translator.go +++ b/controller/api/destination/endpoint_profile_translator.go @@ -6,7 +6,7 @@ import ( pb "github.com/linkerd/linkerd2-proxy-api/go/destination" "github.com/linkerd/linkerd2/controller/api/destination/watcher" "github.com/linkerd/linkerd2/controller/k8s" - log "github.com/sirupsen/logrus" + logging "github.com/sirupsen/logrus" ) type endpointProfileTranslator struct { @@ -19,7 +19,7 @@ type endpointProfileTranslator struct { k8sAPI *k8s.API metadataAPI *k8s.MetadataAPI - log *log.Entry + log *logging.Entry } // newEndpointProfileTranslator translates pod updates and protocol updates to @@ -29,6 +29,7 @@ func newEndpointProfileTranslator( controllerNS, identityTrustDomain string, defaultOpaquePorts map[uint32]struct{}, + log *logging.Entry, stream pb.Destination_GetProfileServer, k8sAPI *k8s.API, metadataAPI *k8s.MetadataAPI, diff --git a/controller/api/destination/server.go b/controller/api/destination/server.go index 2fb637b416567..61abb0e5cb1f8 100644 --- a/controller/api/destination/server.go +++ b/controller/api/destination/server.go @@ -126,21 +126,23 @@ func NewServer( } func (s *server) Get(dest *pb.GetDestination, stream pb.Destination_GetServer) error { - client, _ := peer.FromContext(stream.Context()) log := s.log + + client, _ := peer.FromContext(stream.Context()) if client != nil { - log = s.log.WithField("remote", client.Addr) + log = log.WithField("remote", client.Addr) } - log.Debugf("Get %s", dest.GetPath()) - - streamEnd := make(chan struct{}) var token contextToken if dest.GetContextToken() != "" { + log.Debugf("Dest token: %q", dest.GetContextToken()) token = s.parseContextToken(dest.GetContextToken()) - log.Debugf("Dest token: %v", token) + log = log.WithFields(logging.Fields{"context-pod": token.Pod, "context-ns": token.Ns}) } + log.Debugf("Get %s", dest.GetPath()) + + streamEnd := make(chan struct{}) // The host must be fully-qualified or be an IP address. host, port, err := getHostAndPort(dest.GetPath()) if err != nil { @@ -253,11 +255,20 @@ func (s *server) Get(dest *pb.GetDestination, stream pb.Destination_GetServer) e func (s *server) GetProfile(dest *pb.GetDestination, stream pb.Destination_GetProfileServer) error { log := s.log + client, _ := peer.FromContext(stream.Context()) if client != nil { log = log.WithField("remote", client.Addr) } - log.Debugf("Getting profile for %s with token %q", dest.GetPath(), dest.GetContextToken()) + + var token contextToken + if dest.GetContextToken() != "" { + log.Debugf("Dest token: %q", dest.GetContextToken()) + token = s.parseContextToken(dest.GetContextToken()) + log = log.WithFields(logging.Fields{"context-pod": token.Pod, "context-ns": token.Ns}) + } + + log.Debugf("Getting profile for %s", dest.GetPath()) // The host must be fully-qualified or be an IP address. host, port, err := getHostAndPort(dest.GetPath()) @@ -267,16 +278,17 @@ func (s *server) GetProfile(dest *pb.GetDestination, stream pb.Destination_GetPr } if ip := net.ParseIP(host); ip != nil { - return s.getProfileByIP(dest.GetContextToken(), ip, port, stream) + return s.getProfileByIP(token, ip, port, log, stream) } - return s.getProfileByName(dest.GetContextToken(), host, port, stream) + return s.getProfileByName(token, host, port, log, stream) } func (s *server) getProfileByIP( - token string, + token contextToken, ip net.IP, port uint32, + log *logging.Entry, stream pb.Destination_GetProfileServer, ) error { // Get the service that the IP currently maps to. @@ -286,16 +298,18 @@ func (s *server) getProfileByIP( } if svcID == nil { - return s.subscribeToEndpointProfile(nil, "", ip.String(), port, stream) + return s.subscribeToEndpointProfile(nil, "", ip.String(), port, log, stream) } fqn := fmt.Sprintf("%s.%s.svc.%s", svcID.Name, svcID.Namespace, s.clusterDomain) - return s.subscribeToServiceProfile(*svcID, token, fqn, port, stream) + return s.subscribeToServiceProfile(*svcID, token, fqn, port, log, stream) } func (s *server) getProfileByName( - token, host string, + token contextToken, + host string, port uint32, + log *logging.Entry, stream pb.Destination_GetProfileServer, ) error { service, hostname, err := parseK8sServiceName(host, s.clusterDomain) @@ -308,10 +322,10 @@ func (s *server) getProfileByName( // name. When we fetch the profile using a pod's DNS name, we want to // return an endpoint in the profile response. if hostname != "" { - return s.subscribeToEndpointProfile(&service, hostname, "", port, stream) + return s.subscribeToEndpointProfile(&service, hostname, "", port, log, stream) } - return s.subscribeToServiceProfile(service, token, host, port, stream) + return s.subscribeToServiceProfile(service, token, host, port, log, stream) } // Resolves a profile for a service, sending updates to the provided stream. @@ -319,11 +333,13 @@ func (s *server) getProfileByName( // This function does not return until the stream is closed. func (s *server) subscribeToServiceProfile( service watcher.ID, - token, fqn string, + token contextToken, + fqn string, port uint32, + log *logging.Entry, stream pb.Destination_GetProfileServer, ) error { - log := s.log. + log = log. WithField("ns", service.Namespace). WithField("svc", service.Name). WithField("port", port) @@ -359,11 +375,10 @@ func (s *server) subscribeToServiceProfile( // The primary lookup uses the context token to determine the requester's // namespace. If there's no namespace in the token, start a single // subscription. - tok := s.parseContextToken(token) - if tok.Ns == "" { + if token.Ns == "" { return s.subscribeToServiceWithoutContext(fqn, listener, canceled, log) } - return s.subscribeToServicesWithContext(fqn, tok, listener, canceled, log) + return s.subscribeToServicesWithContext(fqn, token, listener, canceled, log) } // subscribeToServiceWithContext establishes two profile watches: a "backup" @@ -457,6 +472,7 @@ func (s *server) subscribeToEndpointProfile( hostname, ip string, port uint32, + log *logging.Entry, stream pb.Destination_GetProfileServer, ) error { translator := newEndpointProfileTranslator( @@ -464,6 +480,7 @@ func (s *server) subscribeToEndpointProfile( s.controllerNS, s.identityTrustDomain, s.defaultOpaquePorts, + log, stream, s.k8sAPI, s.metadataAPI, @@ -521,6 +538,7 @@ func getSvcID(k8sAPI *k8s.API, clusterIP string, log *logging.Entry) (*watcher.S type contextToken struct { Ns string `json:"ns,omitempty"` NodeName string `json:"nodeName,omitempty"` + Pod string `json:"pod,omitempty"` } func (s *server) parseContextToken(token string) contextToken { diff --git a/controller/proxy-injector/fake/data/pod-with-debug.patch.json b/controller/proxy-injector/fake/data/pod-with-debug.patch.json index 59b9d9a1eb181..5028f184cce0b 100644 --- a/controller/proxy-injector/fake/data/pod-with-debug.patch.json +++ b/controller/proxy-injector/fake/data/pod-with-debug.patch.json @@ -85,7 +85,7 @@ "readOnlyRootFilesystem": true, "seccompProfile": { "type": "RuntimeDefault" - } + } }, "terminationMessagePolicy": "FallbackToLogsOnError", "volumeMounts": [ @@ -257,7 +257,7 @@ }, { "name": "LINKERD2_PROXY_DESTINATION_CONTEXT", - "value": "{\"ns\":\"$(_pod_ns)\", \"nodeName\":\"$(_pod_nodeName)\"}\n" + "value": "{\"ns\":\"$(_pod_ns)\", \"nodeName\":\"$(_pod_nodeName)\", \"pod\":\"$(_pod_name)\"}\n" }, { "name": "_pod_sa", @@ -354,7 +354,7 @@ "runAsUser": 2102, "seccompProfile": { "type": "RuntimeDefault" - } + } }, "terminationMessagePolicy": "FallbackToLogsOnError", "volumeMounts": [ diff --git a/controller/proxy-injector/fake/data/pod-with-ns-annotations.patch.json b/controller/proxy-injector/fake/data/pod-with-ns-annotations.patch.json index 05dcca3507291..2716869a407a2 100644 --- a/controller/proxy-injector/fake/data/pod-with-ns-annotations.patch.json +++ b/controller/proxy-injector/fake/data/pod-with-ns-annotations.patch.json @@ -95,7 +95,7 @@ "readOnlyRootFilesystem": true, "seccompProfile": { "type": "RuntimeDefault" - } + } }, "terminationMessagePolicy": "FallbackToLogsOnError", "volumeMounts": [ @@ -257,7 +257,7 @@ }, { "name": "LINKERD2_PROXY_DESTINATION_CONTEXT", - "value": "{\"ns\":\"$(_pod_ns)\", \"nodeName\":\"$(_pod_nodeName)\"}\n" + "value": "{\"ns\":\"$(_pod_ns)\", \"nodeName\":\"$(_pod_nodeName)\", \"pod\":\"$(_pod_name)\"}\n" }, { "name": "_pod_sa", @@ -362,7 +362,7 @@ "runAsUser": 2102, "seccompProfile": { "type": "RuntimeDefault" - } + } }, "terminationMessagePolicy": "FallbackToLogsOnError", "volumeMounts": [ diff --git a/controller/proxy-injector/fake/data/pod.patch.json b/controller/proxy-injector/fake/data/pod.patch.json index 5df6a8ca5c6eb..9017a44fe1248 100644 --- a/controller/proxy-injector/fake/data/pod.patch.json +++ b/controller/proxy-injector/fake/data/pod.patch.json @@ -85,7 +85,7 @@ "readOnlyRootFilesystem": true, "seccompProfile": { "type": "RuntimeDefault" - } + } }, "terminationMessagePolicy": "FallbackToLogsOnError", "volumeMounts": [ @@ -247,7 +247,7 @@ }, { "name": "LINKERD2_PROXY_DESTINATION_CONTEXT", - "value": "{\"ns\":\"$(_pod_ns)\", \"nodeName\":\"$(_pod_nodeName)\"}\n" + "value": "{\"ns\":\"$(_pod_ns)\", \"nodeName\":\"$(_pod_nodeName)\", \"pod\":\"$(_pod_name)\"}\n" }, { "name": "_pod_sa", @@ -344,7 +344,7 @@ "runAsUser": 2102, "seccompProfile": { "type": "RuntimeDefault" - } + } }, "terminationMessagePolicy": "FallbackToLogsOnError", "volumeMounts": [