Skip to content

Commit c597070

Browse files
cratelynunleashed
andauthored
refactor(app/inbound): remove unused GatewayIdentityRequired (#4483)
* refactor(app/inbound): remove unused `GatewayIdentityRequired` this type is never constructed. accordingly, it can be removed. this was added in #1237 originally, but today it is only checked for as an underlying cause of boxed errors. it is never constructed, and thus can't be the cause of any errors. #2210 later removed the construction of these types while refactoring our stack target types, but this was not identified because of our `is_caused_by()` calls. Signed-off-by: katelyn martin <kate@buoyant.io> * refactor(app/core): remove unused `SyntheticHttpResponse::unauthenticated()` #4483 (comment) Co-Authored-By: Co-authored-by: Alejandro Martinez Ruiz <amr@buoyant.io> Signed-off-by: katelyn martin <kate@buoyant.io> --------- Signed-off-by: katelyn martin <kate@buoyant.io> Co-authored-by: Co-authored-by: Alejandro Martinez Ruiz <amr@buoyant.io>
1 parent ff36472 commit c597070

4 files changed

Lines changed: 1 addition & 22 deletions

File tree

linkerd/app/core/src/errors/respond.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,6 @@ impl SyntheticHttpResponse {
125125
}
126126
}
127127

128-
pub fn unauthenticated(msg: impl ToString) -> Self {
129-
Self {
130-
http_status: http::StatusCode::FORBIDDEN,
131-
grpc_status: tonic::Code::Unauthenticated,
132-
close_connection: false,
133-
message: Cow::Owned(msg.to_string()),
134-
location: None,
135-
}
136-
}
137-
138128
pub fn permission_denied(msg: impl ToString) -> Self {
139129
Self {
140130
http_status: http::StatusCode::FORBIDDEN,

linkerd/app/inbound/src/http/server.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,6 @@ impl errors::HttpRescue<Error> for ServerRescue {
210210
if errors::is_caused_by::<crate::GatewayDomainInvalid>(&*error) {
211211
return Ok(errors::SyntheticHttpResponse::not_found(error));
212212
}
213-
if errors::is_caused_by::<crate::GatewayIdentityRequired>(&*error) {
214-
return Ok(errors::SyntheticHttpResponse::unauthenticated(error));
215-
}
216213
if errors::is_caused_by::<crate::GatewayLoop>(&*error) {
217214
return Ok(errors::SyntheticHttpResponse::loop_detected(error));
218215
}

linkerd/app/inbound/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ pub struct GatewayAddr(pub NameAddr);
8282
// The inbound HTTP server handles gateway traffic; so gateway error types are defined here (so that
8383
// error metrics can be recorded properly).
8484

85-
#[derive(Debug, Error)]
86-
#[error("no identity provided")]
87-
pub struct GatewayIdentityRequired;
88-
8985
#[derive(Debug, Error)]
9086
#[error("bad gateway domain")]
9187
pub struct GatewayDomainInvalid;

linkerd/app/inbound/src/metrics/error.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod tcp;
44
pub(crate) use self::{http::HttpErrorMetrics, tcp::TcpErrorMetrics};
55
use crate::{
66
policy::{HttpRouteNotFound, HttpRouteUnauthorized, ServerUnauthorized},
7-
GatewayDomainInvalid, GatewayIdentityRequired, GatewayLoop,
7+
GatewayDomainInvalid, GatewayLoop,
88
};
99
use linkerd_app_core::{
1010
errors::{FailFastError, LoadShedError},
@@ -19,7 +19,6 @@ enum ErrorKind {
1919
FailFast,
2020
LoadShed,
2121
GatewayDomainInvalid,
22-
GatewayIdentityRequired,
2322
GatewayLoop,
2423
Io,
2524
TlsDetectTimeout,
@@ -46,8 +45,6 @@ impl ErrorKind {
4645
Some(ErrorKind::TlsDetectTimeout)
4746
} else if err.is::<GatewayDomainInvalid>() {
4847
Some(ErrorKind::GatewayDomainInvalid)
49-
} else if err.is::<GatewayIdentityRequired>() {
50-
Some(ErrorKind::GatewayIdentityRequired)
5148
} else if err.is::<GatewayLoop>() {
5249
Some(ErrorKind::GatewayLoop)
5350
} else if err.is::<LoadShedError>() {
@@ -69,7 +66,6 @@ impl FmtLabels for ErrorKind {
6966
ErrorKind::LoadShed => "loadshed",
7067
ErrorKind::FailFast => "failfast",
7168
ErrorKind::TlsDetectTimeout => "tls detection timeout",
72-
ErrorKind::GatewayIdentityRequired => "gateway identity required",
7369
ErrorKind::GatewayLoop => "gateway loop",
7470
ErrorKind::GatewayDomainInvalid => "gateway domain invalid",
7571
ErrorKind::Io => "i/o",

0 commit comments

Comments
 (0)