From bf6678dcbd7128701b6580d4df498a981a2cc3c1 Mon Sep 17 00:00:00 2001 From: Chris Hager Date: Fri, 4 Jul 2025 11:00:00 +0200 Subject: [PATCH] readyz/livez cleanup --- httpserver/handler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/httpserver/handler.go b/httpserver/handler.go index 53817e6..23ca1cc 100644 --- a/httpserver/handler.go +++ b/httpserver/handler.go @@ -11,22 +11,24 @@ func (srv *Server) handleAPI(w http.ResponseWriter, r *http.Request) { func (srv *Server) handleLivenessCheck(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) + w.Write([]byte("OK")) //nolint:errcheck } func (srv *Server) handleReadinessCheck(w http.ResponseWriter, r *http.Request) { if !srv.isReady.Load() { w.WriteHeader(http.StatusServiceUnavailable) + w.Write([]byte("not ready")) //nolint:errcheck return } w.WriteHeader(http.StatusOK) + w.Write([]byte("OK")) //nolint:errcheck } func (srv *Server) handleDrain(w http.ResponseWriter, r *http.Request) { if wasReady := srv.isReady.Swap(false); !wasReady { return } - // l := logutils.ZapFromRequest(r) srv.log.Info("Server marked as not ready") time.Sleep(srv.cfg.DrainDuration) // Give LB enough time to detect us not ready } @@ -35,6 +37,5 @@ func (srv *Server) handleUndrain(w http.ResponseWriter, r *http.Request) { if wasReady := srv.isReady.Swap(true); wasReady { return } - // l := logutils.ZapFromRequest(r) srv.log.Info("Server marked as ready") }