Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions linkerd/app/outbound/src/sidecar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct HttpSidecar {
orig_dst: OrigDstAddr,
version: http::Variant,
routes: watch::Receiver<http::Routes>,
provider: RouteProvider,
}

#[derive(Clone, Debug)]
Expand All @@ -44,6 +45,21 @@ struct OpaqSidecar {
routes: watch::Receiver<opaq::Routes>,
}

#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub enum RouteProvider {
ServiceProfile,
ClientPolicy,
}

impl std::fmt::Debug for RouteProvider {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::ServiceProfile => write!(f, "ServiceProfile"),
Self::ClientPolicy => write!(f, "ClientPolicy"),
}
}
}

// === impl Outbound ===

impl Outbound<()> {
Expand Down Expand Up @@ -196,10 +212,12 @@ impl From<protocol::Http<Sidecar>> for HttpSidecar {
http::spawn_routes(profile, init, move |profile: &profiles::Profile| {
Some(Self::mk_profile_routes(addr.clone(), profile))
});
let provider = RouteProvider::ServiceProfile;
return HttpSidecar {
orig_dst,
version,
routes,
provider,
};
}
}
Expand All @@ -210,10 +228,12 @@ impl From<protocol::Http<Sidecar>> for HttpSidecar {
let routes = http::spawn_routes(policy, init, move |policy: &policy::ClientPolicy| {
Self::mk_policy_routes(orig_dst, version, policy)
});
let provider = RouteProvider::ClientPolicy;
HttpSidecar {
orig_dst,
version,
routes,
provider,
}
}
}
Expand Down Expand Up @@ -334,6 +354,7 @@ impl std::hash::Hash for HttpSidecar {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.orig_dst.hash(state);
self.version.hash(state);
self.provider.hash(state);
}
}

Expand Down
Loading