Skip to content

Commit 1382e32

Browse files
authored
outbound: Clarify Http target types (#653)
The outbound `endpoint::Target` type is generic to the point of being useless. This change modifies the stack target types to be either `HttpLogical`, `HttpConcrete`, or `HttpEndpoint`. Furthermore, the `canonicalize` middleware no longer uses a bespoke trait, instead opting for `AsRef` + `AsMut`. This sets up further changes to the outbound HTTP stack.
1 parent b97909f commit 1382e32

File tree

7 files changed

+194
-239
lines changed

7 files changed

+194
-239
lines changed

linkerd/app/gateway/src/config.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ impl Config {
3535
R: tower::Service<dns::Name, Response = (dns::Name, IpAddr)> + Send + Clone,
3636
R::Error: Into<Error> + 'static,
3737
R::Future: Send + 'static,
38-
O: tower::Service<outbound::Logical<outbound::HttpEndpoint>, Response = S>
39-
+ Send
40-
+ Clone
41-
+ 'static,
38+
O: tower::Service<outbound::HttpLogical, Response = S> + Send + Clone + 'static,
4239
O::Error: Into<Error> + Send + 'static,
4340
O::Future: Send + 'static,
4441
S: Send

linkerd/app/gateway/src/make.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use super::gateway::Gateway;
22
use futures::{future, ready};
3-
use linkerd2_app_core::proxy::api_resolve::Metadata;
4-
use linkerd2_app_core::proxy::identity;
5-
use linkerd2_app_core::{dns, transport::tls, Error, NameAddr};
3+
use linkerd2_app_core::{dns, proxy::identity, transport::tls, Error, NameAddr};
64
use linkerd2_app_inbound::endpoint as inbound;
75
use linkerd2_app_outbound::endpoint as outbound;
86
use std::future::Future;
@@ -52,7 +50,7 @@ where
5250
R: tower::Service<dns::Name, Response = (dns::Name, IpAddr)>,
5351
R::Error: Into<Error> + 'static,
5452
R::Future: Send + 'static,
55-
O: tower::Service<outbound::Logical<outbound::HttpEndpoint>> + Send + Clone + 'static,
53+
O: tower::Service<outbound::HttpLogical> + Send + Clone + 'static,
5654
O::Response: Send + 'static,
5755
O::Future: Send + 'static,
5856
O::Error: Into<Error>,
@@ -119,16 +117,11 @@ where
119117
// Create an outbound target using the resolved IP & name.
120118
let dst_addr = (dst_ip, orig_dst.port()).into();
121119
let dst_name = NameAddr::new(name, orig_dst.port());
122-
let endpoint = outbound::Logical {
123-
addr: dst_name.clone().into(),
124-
inner: outbound::HttpEndpoint {
125-
addr: dst_addr,
126-
settings: http_settings,
127-
metadata: Metadata::empty(),
128-
identity: tls::PeerIdentity::None(
129-
tls::ReasonForNoPeerName::NotProvidedByServiceDiscovery.into(),
130-
),
131-
},
120+
let endpoint = outbound::HttpLogical {
121+
dst: dst_name.clone().into(),
122+
orig_dst: dst_addr,
123+
settings: http_settings,
124+
require_identity: None,
132125
};
133126

134127
let svc = outbound.call(endpoint).await.map_err(Into::into)?;

0 commit comments

Comments
 (0)