From e24ae3afe2173fdfb143df4f4fc29d111610aaad Mon Sep 17 00:00:00 2001 From: Rajiv Singh Date: Tue, 20 Aug 2024 15:32:43 +0530 Subject: [PATCH] add custom logger only log if its not 200 Signed-off-by: Rajiv Singh --- deployment.yaml | 13 ++++++++++--- handlers/handlers.go | 3 +-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/deployment.yaml b/deployment.yaml index 0403c7d..2440e73 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: accesscontrol - image: health:latest # Correct image name + image: ghcr.io/rajiv-maersk/health:main imagePullPolicy: IfNotPresent securityContext: allowPrivilegeEscalation: false @@ -39,8 +39,15 @@ spec: cpu: "40m" readinessProbe: httpGet: - path: /health - port: 8082 # Match this to the port your app is listening on + path: /readiness + port: 8082 initialDelaySeconds: 5 periodSeconds: 10 failureThreshold: 3 + livenessProbe: + httpGet: + path: /liveness + port: 8082 + initialDelaySeconds: 15 + periodSeconds: 20 + failureThreshold: 3 diff --git a/handlers/handlers.go b/handlers/handlers.go index d079513..49f888a 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -1,7 +1,6 @@ package handlers import ( - "errors" "net/http" "github.com/gin-gonic/gin" @@ -16,7 +15,7 @@ type HealthResponse struct { // CheckDatabaseStatus verifies if the database is accessible func CheckDatabaseStatus() error { - return errors.New("Database connection failed") + return nil } // ReadinessProbeHandler returns a Gin handler function that checks the health of the service