support exec in server liveness probe (#971)
Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
This commit is contained in:
parent
36dafa02c0
commit
2bb6994dd9
5 changed files with 60 additions and 1 deletions
|
@ -1,5 +1,9 @@
|
|||
## Unreleased
|
||||
|
||||
Improvements:
|
||||
|
||||
* Support exec in the server liveness probe [GH-971](https://github.com/hashicorp/vault-helm/pull/971)
|
||||
|
||||
## 0.26.1 (October 30, 2023)
|
||||
|
||||
Bugs:
|
||||
|
|
|
@ -179,10 +179,18 @@ spec:
|
|||
{{- end }}
|
||||
{{- if .Values.server.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
{{- if .Values.server.livenessProbe.execCommand }}
|
||||
exec:
|
||||
command:
|
||||
{{- range (.Values.server.livenessProbe.execCommand) }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
httpGet:
|
||||
path: {{ .Values.server.livenessProbe.path | quote }}
|
||||
port: {{ .Values.server.livenessProbe.port }}
|
||||
scheme: {{ include "vault.scheme" . | upper }}
|
||||
{{- end }}
|
||||
failureThreshold: {{ .Values.server.livenessProbe.failureThreshold }}
|
||||
initialDelaySeconds: {{ .Values.server.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.server.livenessProbe.periodSeconds }}
|
||||
|
|
|
@ -1415,6 +1415,41 @@ load _helpers
|
|||
[ "${actual}" = "100" ]
|
||||
}
|
||||
|
||||
@test "server/standalone-StatefulSet: liveness exec disabled by default" {
|
||||
cd `chart_dir`
|
||||
local object=$(helm template \
|
||||
--show-only templates/server-statefulset.yaml \
|
||||
--set 'server.livenessProbe.enabled=true' \
|
||||
. | tee /dev/stderr |
|
||||
yq -r '.spec.template.spec.containers[0].livenessProbe' | tee /dev/stderr)
|
||||
|
||||
local actual=$(echo $object |
|
||||
yq -r '.exec' | tee /dev/stderr)
|
||||
[ "${actual}" = "null" ]
|
||||
|
||||
local actual=$(echo $object |
|
||||
yq -r '.httpGet' | tee /dev/stderr)
|
||||
[ ! "${actual}" = "null" ]
|
||||
}
|
||||
|
||||
@test "server/standalone-StatefulSet: liveness exec can be set" {
|
||||
cd `chart_dir`
|
||||
local object=$(helm template \
|
||||
--show-only templates/server-statefulset.yaml \
|
||||
--set 'server.livenessProbe.enabled=true' \
|
||||
--set='server.livenessProbe.execCommand={/bin/sh,-c,sleep}' \
|
||||
. | tee /dev/stderr |
|
||||
yq -r '.spec.template.spec.containers[0].livenessProbe' | tee /dev/stderr)
|
||||
|
||||
local actual=$(echo $object |
|
||||
yq -r '.exec.command[0]' | tee /dev/stderr)
|
||||
[ "${actual}" = "/bin/sh" ]
|
||||
|
||||
local actual=$(echo $object |
|
||||
yq -r '.httpGet' | tee /dev/stderr)
|
||||
[ "${actual}" = "null" ]
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# args
|
||||
@test "server/standalone-StatefulSet: add extraArgs" {
|
||||
|
|
|
@ -818,6 +818,12 @@
|
|||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"port": {
|
||||
"type": "integer"
|
||||
},
|
||||
"execCommand": {
|
||||
"type": "array"
|
||||
},
|
||||
"periodSeconds": {
|
||||
"type": "integer"
|
||||
},
|
||||
|
|
|
@ -531,8 +531,14 @@ server:
|
|||
# Used to enable a livenessProbe for the pods
|
||||
livenessProbe:
|
||||
enabled: false
|
||||
# Used to define a liveness exec command. If provided, exec is preferred to httpGet (path) as the livenessProbe handler.
|
||||
execCommand: []
|
||||
# - /bin/sh
|
||||
# - -c
|
||||
# - /vault/userconfig/mylivenessscript/run.sh
|
||||
# Path for the livenessProbe to use httpGet as the livenessProbe handler
|
||||
path: "/v1/sys/health?standbyok=true"
|
||||
# Port number on which livenessProbe will be checked.
|
||||
# Port number on which livenessProbe will be checked if httpGet is used as the livenessProbe handler
|
||||
port: 8200
|
||||
# When a probe fails, Kubernetes will try failureThreshold times before giving up
|
||||
failureThreshold: 2
|
||||
|
|
Loading…
Reference in a new issue