Skip to content

Commit

Permalink
redis-ha: make readiness and liveness probes optional, add startup probe
Browse files Browse the repository at this point in the history
Allow disabling the readiness and liveness probes on both Redis and
Sentinel. This can be useful if issues are encountered with the probes.
Also add a startup probe which can better handle the sometimes lengthy
process of loading a large database and subsequently refreshing the
local copy from the primary / master server.

Signed-off-by: Chris Boot <[email protected]>
  • Loading branch information
bootc committed Aug 22, 2024
1 parent 408c54c commit bee2fbf
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/redis-ha/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ keywords:
- redis
- keyvalue
- database
version: 4.27.2
version: 4.27.3
appVersion: 7.2.4
description: This Helm chart provides a highly available Redis implementation with a master/slave configuration and uses Sentinel sidecars for failover management
icon: https://upload.wikimedia.org/wikipedia/en/thumb/6/6b/Redis_Logo.svg/1200px-Redis_Logo.svg.png
Expand Down
16 changes: 16 additions & 0 deletions charts/redis-ha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,24 @@ The following table lists the configurable parameters of the Redis chart and the
| `redis.tlsPort` | TLS Port to access the redis service |``|
| `redis.tlsReplication` | Configures redis with tls-replication parameter, if true sets "tls-replication yes" in redis.conf |``|
| `redis.authClients` | It is possible to disable client side certificates authentication when "authClients" is set to "no" |``|
| `redis.livenessProbe.enabled` | Whether to enable the liveness probe | `30` |
| `redis.livenessProbe.initialDelaySeconds` | Initial delay in seconds for liveness probe | `30` |
| `redis.livenessProbe.periodSeconds` | Period in seconds after which liveness probe will be repeated | `15` |
| `redis.livenessProbe.timeoutSeconds` | Timeout seconds for liveness probe | `15` |
| `redis.livenessProbe.successThreshold` | Success threshold for liveness probe | `1` |
| `redis.livenessProbe.failureThreshold` | Failure threshold for liveness probe | `5` |
| `redis.readinessProbe.enabled` | Whether to enable the readiness probe | `30` |
| `redis.readinessProbe.initialDelaySeconds` | Initial delay in seconds for readiness probe | `30` |
| `redis.readinessProbe.periodSeconds` | Period in seconds after which readiness probe will be repeated | `15` |
| `redis.readinessProbe.timeoutSeconds` | Timeout seconds for readiness probe | `15` |
| `redis.readinessProbe.successThreshold` | Success threshold for readiness probe | `1` |
| `redis.readinessProbe.failureThreshold` | Failure threshold for readiness probe | `5` |
| `redis.startupProbe.enabled` | Whether to enable the startup probe | `30` |
| `redis.startupProbe.initialDelaySeconds` | Initial delay in seconds for startup probe | `30` |
| `redis.startupProbe.periodSeconds` | Period in seconds after which startup probe will be repeated | `15` |
| `redis.startupProbe.timeoutSeconds` | Timeout seconds for startup probe | `15` |
| `redis.startupProbe.successThreshold` | Success threshold for startup probe | `1` |
| `redis.startupProbe.failureThreshold` | Failure threshold for startup probe | `5` |
| `redis.masterGroupName` | Redis convention for naming the cluster group: must match `^[\\w-\\.]+$` and can be templated | `mymaster` |
| `redis.disableCommands` | Array with commands to disable | `["FLUSHDB","FLUSHALL"]` |
| `redis.config` | Any valid redis config options in this section will be applied to each server, For multi-value configs use list instead of string (for example loadmodule) (see below) | see values.yaml |
Expand All @@ -107,16 +115,24 @@ The following table lists the configurable parameters of the Redis chart and the
| `sentinel.tlsPort` | TLS Port to access the sentinel service |``|
| `sentinel.tlsReplication` | Configures sentinel with tls-replication parameter, if true sets "tls-replication yes" in sentinel.conf |``|
| `sentinel.authClients` | It is possible to disable client side certificates authentication when "authClients" is set to "no" |``|
| `sentinel.livenessProbe.enabled` | Whether to enable the liveness probe | `30` |
| `sentinel.livenessProbe.initialDelaySeconds` | Initial delay in seconds for liveness probe | `30` |
| `sentinel.livenessProbe.periodSeconds` | Period in seconds after which liveness probe will be repeated | `15` |
| `sentinel.livenessProbe.timeoutSeconds` | Timeout seconds for liveness probe | `15` |
| `sentinel.livenessProbe.successThreshold` | Success threshold for liveness probe | `1` |
| `sentinel.livenessProbe.failureThreshold` | Failure threshold for liveness probe | `5` |
| `sentinel.readinessProbe.enabled` | Whether to enable the liveness probe | `30` |
| `sentinel.readinessProbe.initialDelaySeconds` | Initial delay in seconds for readiness probe | `30` |
| `sentinel.readinessProbe.periodSeconds` | Period in seconds after which readiness probe will be repeated | `15` |
| `sentinel.readinessProbe.timeoutSeconds` | Timeout seconds for readiness probe | `15` |
| `sentinel.readinessProbe.successThreshold` | Success threshold for readiness probe | `3` |
| `sentinel.readinessProbe.failureThreshold` | Failure threshold for readiness probe | `5` |
| `sentinel.startupProbe.enabled` | Whether to enable the liveness probe | `30` |
| `sentinel.startupProbe.initialDelaySeconds` | Initial delay in seconds for startup probe | `30` |
| `sentinel.startupProbe.periodSeconds` | Period in seconds after which startup probe will be repeated | `15` |
| `sentinel.startupProbe.timeoutSeconds` | Timeout seconds for startup probe | `15` |
| `sentinel.startupProbe.successThreshold` | Success threshold for startup probe | `3` |
| `sentinel.startupProbe.failureThreshold` | Failure threshold for startup probe | `5` |
| `sentinel.auth` | Enables or disables sentinel AUTH (Requires `sentinel.password` to be set) | `false` |
| `sentinel.password` | A password that configures a `requirepass` in the conf parameters (Requires `sentinel.auth: enabled`) |``|
| `sentinel.existingSecret` | An existing secret containing a key defined by `sentinel.authKey` that configures `requirepass` in the conf parameters (Requires `sentinel.auth: enabled`, cannot be used in conjunction with `.Values.sentinel.password`) |``|
Expand Down
34 changes: 34 additions & 0 deletions charts/redis-ha/templates/redis-ha-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ spec:
envFrom:
{{ toYaml .Values.redis.envFrom | indent 10 }}
{{- end }}
{{- if .Values.redis.livenessProbe.enabled }}
livenessProbe:
initialDelaySeconds: {{ .Values.redis.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.redis.livenessProbe.periodSeconds }}
Expand All @@ -290,6 +291,8 @@ spec:
- sh
- -c
- /health/redis_liveness.sh
{{- end }}
{{- if .Values.redis.readinessProbe.enabled }}
readinessProbe:
initialDelaySeconds: {{ .Values.redis.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.redis.readinessProbe.periodSeconds }}
Expand All @@ -301,6 +304,20 @@ spec:
- sh
- -c
- /health/redis_readiness.sh
{{- end }}
{{- if .Values.redis.startupProbe.enabled }}
startupProbe:
initialDelaySeconds: {{ .Values.redis.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.redis.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.redis.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.redis.startupProbe.successThreshold }}
failureThreshold: {{ .Values.redis.startupProbe.failureThreshold }}
exec:
command:
- sh
- -c
- /health/redis_readiness.sh
{{- end }}
resources:
{{ toYaml .Values.redis.resources | indent 10 }}
ports:
Expand Down Expand Up @@ -370,6 +387,7 @@ spec:
key: {{ .Values.sentinel.authKey }}
{{- end }}
{{- end }}
{{- if .Values.sentinel.livenessProbe.enabled }}
livenessProbe:
initialDelaySeconds: {{ .Values.sentinel.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.sentinel.livenessProbe.periodSeconds }}
Expand All @@ -381,6 +399,8 @@ spec:
- sh
- -c
- /health/sentinel_liveness.sh
{{- end }}
{{- if .Values.sentinel.readinessProbe.enabled }}
readinessProbe:
initialDelaySeconds: {{ .Values.sentinel.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.sentinel.readinessProbe.periodSeconds }}
Expand All @@ -392,6 +412,20 @@ spec:
- sh
- -c
- /health/sentinel_liveness.sh
{{- end }}
{{- if .Values.sentinel.startupProbe.enabled }}
startupProbe:
initialDelaySeconds: {{ .Values.sentinel.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.sentinel.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.sentinel.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.sentinel.startupProbe.successThreshold }}
failureThreshold: {{ .Values.sentinel.startupProbe.failureThreshold }}
exec:
command:
- sh
- -c
- /health/sentinel_liveness.sh
{{- end }}
resources:
{{ toYaml .Values.sentinel.resources | indent 10 }}
ports:
Expand Down
20 changes: 20 additions & 0 deletions charts/redis-ha/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -295,19 +295,29 @@ redis:

# liveness probe parameters for redis container
livenessProbe:
enabled: true
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 15
successThreshold: 1
failureThreshold: 5

readinessProbe:
enabled: true
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 15
successThreshold: 1
failureThreshold: 5

startupProbe:
enabled: true
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 15
successThreshold: 1
failureThreshold: 3

disableCommands:
- FLUSHDB
- FLUSHALL
Expand Down Expand Up @@ -391,6 +401,7 @@ sentinel:

# liveness probe parameters for sentinel container
livenessProbe:
enabled: true
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 15
Expand All @@ -399,12 +410,21 @@ sentinel:

# readiness probe parameters for sentinel container
readinessProbe:
enabled: true
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 15
successThreshold: 3
failureThreshold: 5

startupProbe:
enabled: true
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 15
successThreshold: 1
failureThreshold: 3

quorum: 2
config:
## Additional sentinel conf options can be added below. Only options that
Expand Down

0 comments on commit bee2fbf

Please sign in to comment.