From 6730addea4a12c3b1903087c073fd9465c81330b Mon Sep 17 00:00:00 2001 From: = Date: Sat, 7 Feb 2026 23:12:14 +0100 Subject: [PATCH] add tls for liveness and readyness --- chart/templates/deployment.yaml | 6 ++++++ src/internal/server/server.go | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 12afeaa..34e78d8 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -89,6 +89,9 @@ spec: httpGet: path: /ping port: http + {{- if .Values.tls.enabled }} + scheme: HTTPS + {{- end }} initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 @@ -97,6 +100,9 @@ spec: httpGet: path: /health port: http + {{- if .Values.tls.enabled }} + scheme: HTTPS + {{- end }} initialDelaySeconds: 5 periodSeconds: 5 timeoutSeconds: 3 diff --git a/src/internal/server/server.go b/src/internal/server/server.go index d5f2f4e..7d024f1 100644 --- a/src/internal/server/server.go +++ b/src/internal/server/server.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "net/http" + "time" "github.com/gin-gonic/gin" "github.com/kevingruber/gradle-cache/internal/config" @@ -159,7 +160,15 @@ func (s *Server) Run(ctx context.Context) error { select { case <-ctx.Done(): s.logger.Info().Msg("shutting down server") - return srv.Shutdown(context.Background()) + + shutdownCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + if err := srv.Shutdown(shutdownCtx); err != nil { + return fmt.Errorf("server shutdown failed %w", err) + + } + return nil case err := <-errCh: return err }