From 98d0d61958bb84917212f133f769ed3cdaa88c70 Mon Sep 17 00:00:00 2001 From: Deni Bertovic Date: Tue, 18 Jun 2019 10:09:47 +0200 Subject: [PATCH] Adds /healthz endpoint And points k8s readiness and liveness probes on it --- config/routes | 1 + etc/helm/templates/deployment.yaml | 4 ++-- etc/helm/templates/hoogle_deployment.yaml | 4 ++-- src/Handler/Home.hs | 4 ++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config/routes b/config/routes index 61d1506..604f234 100644 --- a/config/routes +++ b/config/routes @@ -8,6 +8,7 @@ /sitemap.xml SitemapR GET / HomeR GET +/healthz HealthzR GET /snapshots AllSnapshotsR GET /snapshot/#Text/*Texts OldSnapshotR GET diff --git a/etc/helm/templates/deployment.yaml b/etc/helm/templates/deployment.yaml index 132efdb..6bf9003 100644 --- a/etc/helm/templates/deployment.yaml +++ b/etc/helm/templates/deployment.yaml @@ -32,7 +32,7 @@ spec: key: PGCONN readinessProbe: httpGet: - path: / + path: /healthz port: 3000 httpHeaders: # Works around stackage-server's `forceSSL` redirect @@ -44,7 +44,7 @@ spec: successThreshold: 1 livenessProbe: httpGet: - path: / + path: /healthz port: 3000 httpHeaders: # Works around stackage-server's `forceSSL` redirect diff --git a/etc/helm/templates/hoogle_deployment.yaml b/etc/helm/templates/hoogle_deployment.yaml index 48290e1..a68d79a 100644 --- a/etc/helm/templates/hoogle_deployment.yaml +++ b/etc/helm/templates/hoogle_deployment.yaml @@ -32,7 +32,7 @@ spec: key: PGCONN readinessProbe: httpGet: - path: / + path: /healthz port: 3000 httpHeaders: # Works around stackage-server's `forceSSL` redirect @@ -44,7 +44,7 @@ spec: successThreshold: 1 livenessProbe: httpGet: - path: / + path: /healthz port: 3000 httpHeaders: # Works around stackage-server's `forceSSL` redirect diff --git a/src/Handler/Home.hs b/src/Handler/Home.hs index 66243b6..a4aa4ca 100644 --- a/src/Handler/Home.hs +++ b/src/Handler/Home.hs @@ -5,6 +5,7 @@ {-# LANGUAGE ViewPatterns #-} module Handler.Home ( getHomeR + , getHealthzR , getAuthorsR , getInstallR , getOlderReleasesR @@ -15,6 +16,9 @@ import Import import Stackage.Database import Yesod.GitRepo (grContent) +getHealthzR :: Handler String +getHealthzR = return "OK" + -- This is a handler function for the G request method on the HomeR -- resource pattern. All of your resource patterns are defined in -- config/routes