From 572b650e0cb195c36f34cc7966e354b6b3a5cd41 Mon Sep 17 00:00:00 2001 From: Bruce Date: Tue, 20 Sep 2022 10:43:40 +0200 Subject: [PATCH] Customize for Personio's use case based on v2.186.0 --- linkerd/app/admin/src/stack.rs | 1 - linkerd/app/core/src/metrics.rs | 8 ++------ linkerd/app/inbound/src/http/router.rs | 3 +-- linkerd/app/outbound/src/endpoint.rs | 13 ++++++------- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/linkerd/app/admin/src/stack.rs b/linkerd/app/admin/src/stack.rs index 49ee959384..081e2d0132 100644 --- a/linkerd/app/admin/src/stack.rs +++ b/linkerd/app/admin/src/stack.rs @@ -224,7 +224,6 @@ impl Param for Permitted { metrics::InboundEndpointLabels { tls: self.http.tcp.tls.clone(), authority: None, - target_addr: self.http.tcp.addr.into(), policy: self.permit.labels.clone(), } .into() diff --git a/linkerd/app/core/src/metrics.rs b/linkerd/app/core/src/metrics.rs index 509a721192..837127222a 100644 --- a/linkerd/app/core/src/metrics.rs +++ b/linkerd/app/core/src/metrics.rs @@ -19,7 +19,6 @@ pub use linkerd_metrics::*; use linkerd_server_policy as policy; use std::{ fmt::{self, Write}, - net::SocketAddr, sync::Arc, time::Duration, }; @@ -67,7 +66,6 @@ pub enum EndpointLabels { pub struct InboundEndpointLabels { pub tls: tls::ConditionalServerTls, pub authority: Option, - pub target_addr: SocketAddr, pub policy: RouteAuthzLabels, } @@ -101,7 +99,6 @@ pub struct OutboundEndpointLabels { pub server_id: tls::ConditionalClientTls, pub authority: Option, pub labels: Option, - pub target_addr: SocketAddr, } #[derive(Clone, Debug, PartialEq, Eq, Hash)] @@ -306,7 +303,7 @@ impl FmtLabels for InboundEndpointLabels { } ( - (TargetAddr(self.target_addr), TlsAccept::from(&self.tls)), + (TlsAccept::from(&self.tls)), &self.policy, ) .fmt_labels(f)?; @@ -373,9 +370,8 @@ impl FmtLabels for OutboundEndpointLabels { write!(f, ",")?; } - let ta = TargetAddr(self.target_addr); let tls = TlsConnect::from(&self.server_id); - (ta, tls).fmt_labels(f)?; + (tls).fmt_labels(f)?; if let Some(labels) = self.labels.as_ref() { write!(f, ",{}", labels)?; diff --git a/linkerd/app/inbound/src/http/router.rs b/linkerd/app/inbound/src/http/router.rs index befe204820..acbcf3b6aa 100644 --- a/linkerd/app/inbound/src/http/router.rs +++ b/linkerd/app/inbound/src/http/router.rs @@ -376,8 +376,7 @@ impl Param for Logical { fn param(&self) -> metrics::EndpointLabels { metrics::InboundEndpointLabels { tls: self.tls.clone(), - authority: self.logical.as_ref().map(|d| d.as_http_authority()), - target_addr: self.addr.into(), + authority: None, policy: self.permit.labels.clone(), } .into() diff --git a/linkerd/app/outbound/src/endpoint.rs b/linkerd/app/outbound/src/endpoint.rs index da7a699dcb..5897400d1e 100644 --- a/linkerd/app/outbound/src/endpoint.rs +++ b/linkerd/app/outbound/src/endpoint.rs @@ -121,15 +121,14 @@ impl

svc::Param for Endpoint

{ impl

svc::Param for Endpoint

{ fn param(&self) -> metrics::OutboundEndpointLabels { - let authority = self - .logical_addr - .as_ref() - .map(|LogicalAddr(a)| a.as_http_authority()); + + let dst_labels_arc = self.metadata.labels(); + let dst_labels_for_metrics = dst_labels_arc.iter().filter(|(k, _v)| k.as_str() != "pod" && k.as_str() != "pod_template_hash"); + metrics::OutboundEndpointLabels { - authority, - labels: metrics::prefix_labels("dst", self.metadata.labels().iter()), + authority: None, + labels: metrics::prefix_labels("dst", dst_labels_for_metrics), server_id: self.tls.clone(), - target_addr: self.addr.into(), } } }