LivenessProbe support - you can use it, doesn't mean you should

This commit is contained in:
Laszlo Fogas
2021-09-18 15:24:21 +02:00
parent d9fa868eaa
commit f38708f864
3 changed files with 66 additions and 0 deletions
+10
View File
@@ -84,6 +84,16 @@ spec:
{{- toYaml . | nindent 12 }} {{- toYaml . | nindent 12 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.livenessProbe.path }}
port: {{ .Values.containerPort }}
scheme: HTTP
{{- with .Values.livenessProbe.settings }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- include "common.volumeMountsRef.tpl" . | nindent 10 }} {{- include "common.volumeMountsRef.tpl" . | nindent 10 }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
@@ -0,0 +1,45 @@
suite: test deployment
templates:
- deployment.yaml
- configmap.yaml
tests:
- it: Should set a liveness probe
set:
livenessProbe:
enabled: true
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
value:
httpGet:
path: "/"
port: 80
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
failureThreshold: 3
- it: Should not set a livenessProbe
asserts:
- isNull:
path: spec.template.spec.containers[0].livenessProbe
- it: Should tune liveness probe
set:
livenessProbe:
enabled: true
settings:
periodSeconds: 30
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe
value:
httpGet:
path: "/"
port: 80
scheme: HTTP
initialDelaySeconds: 0
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 3
failureThreshold: 3
+11
View File
@@ -40,6 +40,17 @@ probe:
timeoutSeconds: 3 timeoutSeconds: 3
failureThreshold: 3 failureThreshold: 3
# Before you use a liveness probe: https://srcco.de/posts/kubernetes-liveness-probes-are-dangerous.html
livenessProbe:
enabled: false
path: "/"
settings:
initialDelaySeconds: 0
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 3
failureThreshold: 3
secretEnabled: false secretEnabled: false
shell: "/bin/sh" shell: "/bin/sh"