From feed8302853be43f11d7e7f48e63f4ddcb51d632 Mon Sep 17 00:00:00 2001 From: Alex Leong Date: Mon, 13 Apr 2020 10:48:51 -0700 Subject: [PATCH] Add liveness endpoint to admin server (#470) Relates to https://github.com/linkerd/linkerd2/issues/3984 Add a `/live` endpoint to the admin server which always returns a 200 success. This can be used for liveness checking. Signed-off-by: Alex Leong --- linkerd/app/core/src/admin/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linkerd/app/core/src/admin/mod.rs b/linkerd/app/core/src/admin/mod.rs index 41568716d..bee9e1fb5 100644 --- a/linkerd/app/core/src/admin/mod.rs +++ b/linkerd/app/core/src/admin/mod.rs @@ -59,6 +59,13 @@ impl Admin { .expect("builder with known status code must not fail") } } + + fn live_rsp(&self) -> Response { + Response::builder() + .status(StatusCode::OK) + .body("live\n".into()) + .expect("builder with known status code must not fail") + } } impl Service for Admin { @@ -72,6 +79,7 @@ impl Service for Admin { "/metrics" => Box::new(self.metrics.call(req)), "/proxy-log-level" => self.trace_level.call(req), "/ready" => Box::new(future::ok(self.ready_rsp())), + "/live" => Box::new(future::ok(self.live_rsp())), _ => Box::new(future::ok(rsp(StatusCode::NOT_FOUND, Body::empty()))), } }