Skip to content

Commit

Permalink
feat: add health check startup probe
Browse files Browse the repository at this point in the history
  • Loading branch information
lvlcn-t committed Jan 28, 2024
1 parent d1d1bdc commit 38133af
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
18 changes: 18 additions & 0 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,21 @@ Create the name of the service account to use
{{- define "sparrow.sparrowConfigName"}}
{{- include "sparrow.fullname" . }}-config
{{- end }}

{{/*
Convert duration to seconds
*/}}
{{- define "sparrow.durationToSeconds" -}}
{{- $duration := . -}}
{{- if hasSuffix "ms" $duration -}}
{{- trimSuffix "ms" $duration | div 1000 | int -}}
{{- else if hasSuffix "s" $duration -}}
{{- trimSuffix "s" $duration | int -}}
{{- else if hasSuffix "m" $duration -}}
{{- trimSuffix "m" $duration | mul 60 | int -}}
{{- else if hasSuffix "h" $duration -}}
{{- trimSuffix "h" $duration | mul 3600 | int -}}
{{- else -}}
{{- $duration | int -}}
{{- end -}}
{{- end -}}
13 changes: 13 additions & 0 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ spec:
volumeMounts:
- name: sparrow-config
mountPath: /config/
readinessProbe:
httpGet:
port: http
failureThreshold: 5
periodSeconds: 5
{{- if .Values.checksConfig.checks.health }}
startupProbe:
httpGet:
path: /v1/metrics/health
port: http
initialDelaySeconds: {{ include "sparrow.durationToSeconds" .Values.checksConfig.checks.health.interval | default 15 }}
failureThreshold: 10
{{- end }}
volumes:
- name: sparrow-config
configMap:
Expand Down

0 comments on commit 38133af

Please sign in to comment.