From 485fa24eee4543ff157cd02946c7bcde527803cf Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Fri, 16 Feb 2024 16:30:57 +0100 Subject: [PATCH] add liveness, readiness and startup probes as config --- templates/_helpers.tpl | 36 +++++++++++++++++++++++++++++++++++- templates/door.yaml | 17 +++++++++++------ templates/pool.yaml | 17 +++++++++++------ values.yaml | 30 ++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 13 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 1da9345..7340963 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -50,4 +50,38 @@ dCache conf and layout config map items: - key: "dcache-k8s-door" path: "dcache-k8s.conf" -{{- end }} \ No newline at end of file +{{- end }} + +{{/* +Readiness probe +*/}} +{{- define "dcache.readiness.probe" }} +readinessProbe: + initialDelaySeconds: {{.Values.readinessProbe.initialDelaySeconds }} + timeoutSeconds: {{.Values.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} +{{- end }} + +{{/* +Liveness probe +*/}} +{{- define "dcache.liveness.probe" }} +livenessProbe: + initialDelaySeconds: {{.Values.livenessProbe.initialDelaySeconds }} + timeoutSeconds: {{.Values.livenessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} +{{- end }} + + +{{/* +Startup probe +*/}} +{{- define "dcache.startup.probe" }} +startupProbe: + initialDelaySeconds: {{.Values.startupProbe.initialDelaySeconds }} + timeoutSeconds: {{.Values.startupProbe.timeoutSeconds }} + failureThreshold: {{ .Values.startupProbe.failureThreshold }} + successThreshold: {{ .Values.startupProbe.successThreshold }} +{{- end }} diff --git a/templates/door.yaml b/templates/door.yaml index b8bf4cc..d84cb74 100644 --- a/templates/door.yaml +++ b/templates/door.yaml @@ -18,16 +18,21 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} command: ["/run.sh", "door-svc" ] - readinessProbe: + {{- if .Values.readinessProbe.enabled}} + {{ include "dcache.readiness.probe" . | indent 8 }} tcpSocket: port: 2049 - initialDelaySeconds: 20 - timeoutSeconds: 5 - livenessProbe: + {{- end}} + {{- if .Values.livenessProbe.enabled}} + {{ include "dcache.liveness.probe" . | indent 8 }} tcpSocket: port: 2049 - initialDelaySeconds: 90 - timeoutSeconds: 5 + {{- end}} + {{- if .Values.startupProbe.enabled}} + {{ include "dcache.startup.probe" . | indent 8 }} + tcpSocket: + port: 2049 + {{- end}} volumeMounts: {{ include "dcache.conf.mounts" . | indent 8 }} - name: init-scripts diff --git a/templates/pool.yaml b/templates/pool.yaml index 60b20b1..2dd6659 100644 --- a/templates/pool.yaml +++ b/templates/pool.yaml @@ -19,16 +19,21 @@ spec: image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.AppVersion }}" imagePullPolicy: {{ $.Values.image.pullPolicy }} command: ["/run.sh", "pool-{{ . }}-svc"] - readinessProbe: + {{- if $.Values.readinessProbe.enabled}} + {{ include "dcache.readiness.probe" $ | indent 8 }} tcpSocket: port: {{ $.Values.mover.nfs }} - initialDelaySeconds: 20 - timeoutSeconds: 5 - livenessProbe: + {{- end}} + {{- if $.Values.livenessProbe.enabled}} + {{ include "dcache.liveness.probe" $ | indent 8 }} tcpSocket: port: {{ $.Values.mover.nfs }} - initialDelaySeconds: 90 - timeoutSeconds: 5 + {{- end}} + {{- if $.Values.startupProbe.enabled}} + {{ include "dcache.startup.probe" $ | indent 8 }} + tcpSocket: + port: {{ $.Values.mover.nfs }} + {{- end}} volumeMounts: {{ include "dcache.conf.mounts" . | indent 8 }} - name: certs-store-{{ . }} diff --git a/values.yaml b/values.yaml index 2d1cca1..5343343 100644 --- a/values.yaml +++ b/values.yaml @@ -24,6 +24,36 @@ cell: zookeeper: servers: cells-zookeeper:2181 + +# liveness, readiness and startup probes + +# dCache containers' liveness probe. +livenessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + +# dCache containers' readiness probe. +readinessProbe: + enabled: true + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + +# dCache containers' startup probe. +startupProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 15 + successThreshold: 1 + # # dCache doors/services #