Skip to content

Commit 1a12be5

Browse files
authored
chore(app/inbound): remove Default bounds (#3654)
see linkerd/linkerd2#8733 for more information. see also, #3651 and #3653 for some related pull requests. in hyper 1.x, `Incoming` bodies do not provide a `Default` implementation. compare the trait implementations here: * https://docs.rs/hyper/0.14.31/hyper/body/struct.Body.html#impl-Default-for-Body * https://docs.rs/hyper/latest/hyper/body/struct.Incoming.html#trait-implementations this commit removes `Default` bounds from policy lookup in the inbound proxy. Signed-off-by: katelyn martin <[email protected]>
1 parent 5ee4f71 commit 1a12be5

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

linkerd/app/inbound/src/policy/api.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ static INVALID_POLICY: once_cell::sync::OnceCell<ServerPolicy> = once_cell::sync
3434
impl<S> Api<S>
3535
where
3636
S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error> + Clone,
37-
S::ResponseBody:
38-
http::Body<Data = tonic::codegen::Bytes, Error = Error> + Default + Send + 'static,
37+
S::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error> + Send + 'static,
3938
{
4039
pub(super) fn new(
4140
workload: Arc<str>,
@@ -60,8 +59,7 @@ impl<S> Service<u16> for Api<S>
6059
where
6160
S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
6261
S: Clone + Send + Sync + 'static,
63-
S::ResponseBody:
64-
http::Body<Data = tonic::codegen::Bytes, Error = Error> + Default + Send + 'static,
62+
S::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error> + Send + 'static,
6563
S::Future: Send + 'static,
6664
{
6765
type Response =

linkerd/app/inbound/src/policy/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Config {
4343
C: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
4444
C: Clone + Unpin + Send + Sync + 'static,
4545
C::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error>,
46-
C::ResponseBody: Default + Send + 'static,
46+
C::ResponseBody: Send + 'static,
4747
C::Future: Send,
4848
{
4949
match self {

linkerd/app/inbound/src/policy/store.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ impl<S> Store<S> {
7777
S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
7878
S: Clone + Send + Sync + 'static,
7979
S::Future: Send,
80-
S::ResponseBody:
81-
http::Body<Data = tonic::codegen::Bytes, Error = Error> + Default + Send + 'static,
80+
S::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error> + Send + 'static,
8281
{
8382
let opaque_default = Self::make_opaque(default.clone());
8483
// The initial set of policies never expire from the cache.
@@ -142,8 +141,7 @@ where
142141
S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
143142
S: Clone + Send + Sync + 'static,
144143
S::Future: Send,
145-
S::ResponseBody:
146-
http::Body<Data = tonic::codegen::Bytes, Error = Error> + Default + Send + 'static,
144+
S::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error> + Send + 'static,
147145
{
148146
fn get_policy(&self, dst: OrigDstAddr) -> AllowPolicy {
149147
// Lookup the policy for the target port in the cache. If it doesn't

linkerd/app/inbound/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl Inbound<()> {
3030
C: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
3131
C: Clone + Unpin + Send + Sync + 'static,
3232
C::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error>,
33-
C::ResponseBody: Default + Send + 'static,
33+
C::ResponseBody: Send + 'static,
3434
C::Future: Send,
3535
{
3636
self.config

0 commit comments

Comments
 (0)