Skip to content

Commit 6730add

Browse files
add tls for liveness and readyness
1 parent 859b78f commit 6730add

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

chart/templates/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ spec:
8989
httpGet:
9090
path: /ping
9191
port: http
92+
{{- if .Values.tls.enabled }}
93+
scheme: HTTPS
94+
{{- end }}
9295
initialDelaySeconds: 10
9396
periodSeconds: 10
9497
timeoutSeconds: 5
@@ -97,6 +100,9 @@ spec:
97100
httpGet:
98101
path: /health
99102
port: http
103+
{{- if .Values.tls.enabled }}
104+
scheme: HTTPS
105+
{{- end }}
100106
initialDelaySeconds: 5
101107
periodSeconds: 5
102108
timeoutSeconds: 3

src/internal/server/server.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"net/http"
7+
"time"
78

89
"github.com/gin-gonic/gin"
910
"github.com/kevingruber/gradle-cache/internal/config"
@@ -159,7 +160,15 @@ func (s *Server) Run(ctx context.Context) error {
159160
select {
160161
case <-ctx.Done():
161162
s.logger.Info().Msg("shutting down server")
162-
return srv.Shutdown(context.Background())
163+
164+
shutdownCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
165+
defer cancel()
166+
167+
if err := srv.Shutdown(shutdownCtx); err != nil {
168+
return fmt.Errorf("server shutdown failed %w", err)
169+
170+
}
171+
return nil
163172
case err := <-errCh:
164173
return err
165174
}

0 commit comments

Comments
 (0)