Add configurable probe values (#387)

* Add configurable probe values

* Remove template defaults

* Update values.yaml

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>

* Update values.yaml

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>

* Update values.yaml

Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>

* Switch timeout and period defaults

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
This commit is contained in:
Jason O'Donnell 2020-09-15 16:24:38 -04:00 committed by GitHub
parent 3975d2c331
commit fc8ebfdd4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 223 additions and 12 deletions

View file

@ -141,11 +141,11 @@ spec:
exec: exec:
command: ["/bin/sh", "-ec", "vault status -tls-skip-verify"] command: ["/bin/sh", "-ec", "vault status -tls-skip-verify"]
{{- end }} {{- end }}
failureThreshold: 2 failureThreshold: {{ .Values.server.readinessProbe.failureThreshold }}
initialDelaySeconds: 5 initialDelaySeconds: {{ .Values.server.readinessProbe.initialDelaySeconds }}
periodSeconds: 3 periodSeconds: {{ .Values.server.readinessProbe.periodSeconds }}
successThreshold: 1 successThreshold: {{ .Values.server.readinessProbe.successThreshold }}
timeoutSeconds: 5 timeoutSeconds: {{ .Values.server.readinessProbe.timeoutSeconds }}
{{- end }} {{- end }}
{{- if .Values.server.livenessProbe.enabled }} {{- if .Values.server.livenessProbe.enabled }}
livenessProbe: livenessProbe:
@ -153,10 +153,11 @@ spec:
path: {{ .Values.server.livenessProbe.path | quote }} path: {{ .Values.server.livenessProbe.path | quote }}
port: 8200 port: 8200
scheme: {{ include "vault.scheme" . | upper }} scheme: {{ include "vault.scheme" . | upper }}
failureThreshold: {{ .Values.server.livenessProbe.failureThreshold }}
initialDelaySeconds: {{ .Values.server.livenessProbe.initialDelaySeconds }} initialDelaySeconds: {{ .Values.server.livenessProbe.initialDelaySeconds }}
periodSeconds: 3 periodSeconds: {{ .Values.server.livenessProbe.periodSeconds }}
successThreshold: 1 successThreshold: {{ .Values.server.livenessProbe.successThreshold }}
timeoutSeconds: 5 timeoutSeconds: {{ .Values.server.livenessProbe.timeoutSeconds }}
{{- end }} {{- end }}
lifecycle: lifecycle:
# Vault container doesn't receive SIGTERM from Kubernetes # Vault container doesn't receive SIGTERM from Kubernetes

View file

@ -962,6 +962,110 @@ load _helpers
[ "${actual}" = "null" ] [ "${actual}" = "null" ]
} }
@test "server/standalone-StatefulSet: readiness failureThreshold default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.readinessProbe.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].readinessProbe.failureThreshold' | tee /dev/stderr)
[ "${actual}" = "2" ]
}
@test "server/standalone-StatefulSet: readiness failureThreshold configurable" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.readinessProbe.enabled=true' \
--set 'server.readinessProbe.failureThreshold=100' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].readinessProbe.failureThreshold' | tee /dev/stderr)
[ "${actual}" = "100" ]
}
@test "server/standalone-StatefulSet: readiness initialDelaySeconds default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.readinessProbe.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].readinessProbe.initialDelaySeconds' | tee /dev/stderr)
[ "${actual}" = "5" ]
}
@test "server/standalone-StatefulSet: readiness initialDelaySeconds configurable" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.readinessProbe.enabled=true' \
--set 'server.readinessProbe.initialDelaySeconds=100' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].readinessProbe.initialDelaySeconds' | tee /dev/stderr)
[ "${actual}" = "100" ]
}
@test "server/standalone-StatefulSet: readiness periodSeconds default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.readinessProbe.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].readinessProbe.periodSeconds' | tee /dev/stderr)
[ "${actual}" = "5" ]
}
@test "server/standalone-StatefulSet: readiness periodSeconds configurable" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.readinessProbe.enabled=true' \
--set 'server.readinessProbe.periodSeconds=100' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].readinessProbe.periodSeconds' | tee /dev/stderr)
[ "${actual}" = "100" ]
}
@test "server/standalone-StatefulSet: readiness successThreshold default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.readinessProbe.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].readinessProbe.successThreshold' | tee /dev/stderr)
[ "${actual}" = "1" ]
}
@test "server/standalone-StatefulSet: readiness successThreshold configurable" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.readinessProbe.enabled=true' \
--set 'server.readinessProbe.successThreshold=100' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].readinessProbe.successThreshold' | tee /dev/stderr)
[ "${actual}" = "100" ]
}
@test "server/standalone-StatefulSet: readiness timeoutSeconds default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.readinessProbe.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].readinessProbe.timeoutSeconds' | tee /dev/stderr)
[ "${actual}" = "3" ]
}
@test "server/standalone-StatefulSet: readiness timeoutSeconds configurable" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.readinessProbe.enabled=true' \
--set 'server.readinessProbe.timeoutSeconds=100' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].readinessProbe.timeoutSeconds' | tee /dev/stderr)
[ "${actual}" = "100" ]
}
@test "server/standalone-StatefulSet: livenessProbe default" { @test "server/standalone-StatefulSet: livenessProbe default" {
cd `chart_dir` cd `chart_dir`
@ -982,7 +1086,28 @@ load _helpers
[ "${actual}" = "/v1/sys/health?standbyok=true" ] [ "${actual}" = "/v1/sys/health?standbyok=true" ]
} }
@test "server/standalone-StatefulSet: livenessProbe initialDelaySeconds default" { @test "server/standalone-StatefulSet: liveness failureThreshold default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.livenessProbe.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].livenessProbe.failureThreshold' | tee /dev/stderr)
[ "${actual}" = "2" ]
}
@test "server/standalone-StatefulSet: liveness failureThreshold configurable" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.livenessProbe.enabled=true' \
--set 'server.livenessProbe.failureThreshold=100' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].livenessProbe.failureThreshold' | tee /dev/stderr)
[ "${actual}" = "100" ]
}
@test "server/standalone-StatefulSet: liveness initialDelaySeconds default" {
cd `chart_dir` cd `chart_dir`
local actual=$(helm template \ local actual=$(helm template \
--show-only templates/server-statefulset.yaml \ --show-only templates/server-statefulset.yaml \
@ -992,17 +1117,82 @@ load _helpers
[ "${actual}" = "60" ] [ "${actual}" = "60" ]
} }
@test "server/standalone-StatefulSet: livenessProbe initialDelaySeconds configurable" { @test "server/standalone-StatefulSet: liveness initialDelaySeconds configurable" {
cd `chart_dir` cd `chart_dir`
local actual=$(helm template \ local actual=$(helm template \
--show-only templates/server-statefulset.yaml \ --show-only templates/server-statefulset.yaml \
--set 'server.livenessProbe.enabled=true' \ --set 'server.livenessProbe.enabled=true' \
--set 'server.livenessProbe.initialDelaySeconds=30' \ --set 'server.livenessProbe.initialDelaySeconds=100' \
. | tee /dev/stderr | . | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].livenessProbe.initialDelaySeconds' | tee /dev/stderr) yq -r '.spec.template.spec.containers[0].livenessProbe.initialDelaySeconds' | tee /dev/stderr)
[ "${actual}" = "30" ] [ "${actual}" = "100" ]
} }
@test "server/standalone-StatefulSet: liveness periodSeconds default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.livenessProbe.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].livenessProbe.periodSeconds' | tee /dev/stderr)
[ "${actual}" = "5" ]
}
@test "server/standalone-StatefulSet: liveness periodSeconds configurable" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.livenessProbe.enabled=true' \
--set 'server.livenessProbe.periodSeconds=100' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].livenessProbe.periodSeconds' | tee /dev/stderr)
[ "${actual}" = "100" ]
}
@test "server/standalone-StatefulSet: liveness successThreshold default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.livenessProbe.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].livenessProbe.successThreshold' | tee /dev/stderr)
[ "${actual}" = "1" ]
}
@test "server/standalone-StatefulSet: liveness successThreshold configurable" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.livenessProbe.enabled=true' \
--set 'server.livenessProbe.successThreshold=100' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].livenessProbe.successThreshold' | tee /dev/stderr)
[ "${actual}" = "100" ]
}
@test "server/standalone-StatefulSet: liveness timeoutSeconds default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.livenessProbe.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].livenessProbe.timeoutSeconds' | tee /dev/stderr)
[ "${actual}" = "3" ]
}
@test "server/standalone-StatefulSet: liveness timeoutSeconds configurable" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.livenessProbe.enabled=true' \
--set 'server.livenessProbe.timeoutSeconds=100' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].livenessProbe.timeoutSeconds' | tee /dev/stderr)
[ "${actual}" = "100" ]
}
#--------------------------------------------------------------------
# args
@test "server/standalone-StatefulSet: add extraArgs" { @test "server/standalone-StatefulSet: add extraArgs" {
cd `chart_dir` cd `chart_dir`
local actual=$(helm template \ local actual=$(helm template \

View file

@ -218,11 +218,31 @@ server:
enabled: true enabled: true
# If you need to use a http path instead of the default exec # If you need to use a http path instead of the default exec
# path: /v1/sys/health?standbyok=true # path: /v1/sys/health?standbyok=true
# When a probe fails, Kubernetes will try failureThreshold times before giving up
failureThreshold: 2
# Number of seconds after the container has started before probe initiates
initialDelaySeconds: 5
# How often (in seconds) to perform the probe
periodSeconds: 5
# Minimum consecutive successes for the probe to be considered successful after having failed
successThreshold: 1
# Number of seconds after which the probe times out.
timeoutSeconds: 3
# Used to enable a livenessProbe for the pods # Used to enable a livenessProbe for the pods
livenessProbe: livenessProbe:
enabled: false enabled: false
path: "/v1/sys/health?standbyok=true" path: "/v1/sys/health?standbyok=true"
# When a probe fails, Kubernetes will try failureThreshold times before giving up
failureThreshold: 2
# Number of seconds after the container has started before probe initiates
initialDelaySeconds: 60 initialDelaySeconds: 60
# How often (in seconds) to perform the probe
periodSeconds: 5
# Minimum consecutive successes for the probe to be considered successful after having failed
successThreshold: 1
# Number of seconds after which the probe times out.
timeoutSeconds: 3
# Used to set the sleep time during the preStop step # Used to set the sleep time during the preStop step
preStopSleepSeconds: 5 preStopSleepSeconds: 5