From bb48a5867a95d264e2473f3c1c42ff972b51f2bb Mon Sep 17 00:00:00 2001 From: Zach Hayes Date: Wed, 11 Mar 2026 16:40:24 -0700 Subject: [PATCH 1/2] add health check --- api/v1/health/router.go | 16 ++++++++++++++++ api/v1/v1.go | 2 ++ deploy/reverse-watch-service.yaml | 8 ++++++++ 3 files changed, 26 insertions(+) create mode 100644 api/v1/health/router.go diff --git a/api/v1/health/router.go b/api/v1/health/router.go new file mode 100644 index 00000000..d46fc25d --- /dev/null +++ b/api/v1/health/router.go @@ -0,0 +1,16 @@ +package health + +import ( + "net/http" + + "github.com/go-chi/chi/v5" +) + +func Router() chi.Router { + r := chi.NewRouter() + r.Get("/", func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + w.Write([]byte("OK")) + }) + return r +} diff --git a/api/v1/v1.go b/api/v1/v1.go index 296ed636..e4ffe1b3 100644 --- a/api/v1/v1.go +++ b/api/v1/v1.go @@ -2,6 +2,7 @@ package v1 import ( "reverse-watch/api/v1/admin" + "reverse-watch/api/v1/health" "reverse-watch/api/v1/marketplace" "reverse-watch/api/v1/reversals" "reverse-watch/api/v1/users" @@ -11,6 +12,7 @@ import ( func Router() chi.Router { r := chi.NewRouter() + r.Mount("/health", health.Router()) r.Mount("/marketplace", marketplace.Router()) r.Mount("/reversals", reversals.Router()) r.Mount("/users", users.Router()) diff --git a/deploy/reverse-watch-service.yaml b/deploy/reverse-watch-service.yaml index 2cc1cad4..fadc8d66 100644 --- a/deploy/reverse-watch-service.yaml +++ b/deploy/reverse-watch-service.yaml @@ -71,6 +71,14 @@ spec: failureThreshold: 1 tcpSocket: port: 80 + livenessProbe: + initialDelaySeconds: 10 + timeoutSeconds: 1 + periodSeconds: 10 + failureThreshold: 3 + httpGet: + path: /api/v1/health + port: 80 traffic: - percent: 100 latestRevision: true From 8bcf36631d3626f94c417b3c5ffdd72bb962d72b Mon Sep 17 00:00:00 2001 From: Zach Hayes Date: Mon, 16 Mar 2026 11:15:59 -0700 Subject: [PATCH 2/2] reduce initial delay of liveness probe --- deploy/reverse-watch-service.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/reverse-watch-service.yaml b/deploy/reverse-watch-service.yaml index fadc8d66..8614a68c 100644 --- a/deploy/reverse-watch-service.yaml +++ b/deploy/reverse-watch-service.yaml @@ -72,7 +72,7 @@ spec: tcpSocket: port: 80 livenessProbe: - initialDelaySeconds: 10 + initialDelaySeconds: 5 timeoutSeconds: 1 periodSeconds: 10 failureThreshold: 3