Skip to content

Commit

Permalink
chore(app/inbound): remove Default bounds
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
cratelyn committed Feb 25, 2025
1 parent ea8a970 commit 7673074
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions linkerd/app/inbound/src/policy/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ static INVALID_POLICY: once_cell::sync::OnceCell<ServerPolicy> = once_cell::sync
impl<S> Api<S>
where
S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error> + Clone,
S::ResponseBody:
http::Body<Data = tonic::codegen::Bytes, Error = Error> + Default + Send + 'static,
S::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error> + Send + 'static,
{
pub(super) fn new(
workload: Arc<str>,
Expand All @@ -60,8 +59,7 @@ impl<S> Service<u16> for Api<S>
where
S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
S: Clone + Send + Sync + 'static,
S::ResponseBody:
http::Body<Data = tonic::codegen::Bytes, Error = Error> + Default + Send + 'static,
S::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error> + Send + 'static,
S::Future: Send + 'static,
{
type Response =
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/inbound/src/policy/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Config {
C: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
C: Clone + Unpin + Send + Sync + 'static,
C::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error>,
C::ResponseBody: Default + Send + 'static,
C::ResponseBody: Send + 'static,
C::Future: Send,
{
match self {
Expand Down
6 changes: 2 additions & 4 deletions linkerd/app/inbound/src/policy/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ impl<S> Store<S> {
S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
S: Clone + Send + Sync + 'static,
S::Future: Send,
S::ResponseBody:
http::Body<Data = tonic::codegen::Bytes, Error = Error> + Default + Send + 'static,
S::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error> + Send + 'static,
{
let opaque_default = Self::make_opaque(default.clone());
// The initial set of policies never expire from the cache.
Expand Down Expand Up @@ -142,8 +141,7 @@ where
S: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
S: Clone + Send + Sync + 'static,
S::Future: Send,
S::ResponseBody:
http::Body<Data = tonic::codegen::Bytes, Error = Error> + Default + Send + 'static,
S::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error> + Send + 'static,
{
fn get_policy(&self, dst: OrigDstAddr) -> AllowPolicy {
// Lookup the policy for the target port in the cache. If it doesn't
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/inbound/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Inbound<()> {
C: tonic::client::GrpcService<tonic::body::BoxBody, Error = Error>,
C: Clone + Unpin + Send + Sync + 'static,
C::ResponseBody: http::Body<Data = tonic::codegen::Bytes, Error = Error>,
C::ResponseBody: Default + Send + 'static,
C::ResponseBody: Send + 'static,
C::Future: Send,
{
self.config
Expand Down

0 comments on commit 7673074

Please sign in to comment.