feat(argo-cd): Add Probes for redis

Signed-off-by: François Blondel <francois.blondel@diva-e.com>
This commit is contained in:
François Blondel 2024-02-02 00:26:01 +01:00
parent 4a50afcc77
commit f97095050f
6 changed files with 133 additions and 2 deletions

View file

@ -26,5 +26,10 @@ annotations:
fingerprint: 2B8F22F57260EFA67BE1C5824B11F800CD9D2252
url: https://argoproj.github.io/argo-helm/pgp_keys.asc
artifacthub.io/changes: |
<<<<<<< HEAD
- kind: changed
description: refresh from upstream
=======
- kind: added
description: Add Probes for redis
>>>>>>> 8adc4c1 (feat(argo-cd): Add Probes for redis)

View file

@ -968,6 +968,8 @@ server:
| redis.exporter.image.imagePullPolicy | string | `""` (defaults to global.image.imagePullPolicy) | Image pull policy for the redis-exporter |
| redis.exporter.image.repository | string | `"public.ecr.aws/bitnami/redis-exporter"` | Repository to use for the redis-exporter |
| redis.exporter.image.tag | string | `"1.57.0"` | Tag to use for the redis-exporter |
| redis.exporter.livenessProbe | object | `{"failureThreshold":5,"initialDelaySeconds":30,"periodSeconds":15,"successThreshold":1,"timeoutSeconds":15}` | livenessProbe parameters to pass to the Redis server |
| redis.exporter.readinessProbe | object | `{"failureThreshold":5,"initialDelaySeconds":30,"periodSeconds":15,"successThreshold":1,"timeoutSeconds":15}` | readinessProbe parameters to pass to the Redis server |
| redis.exporter.resources | object | `{}` | Resource limits and requests for redis-exporter sidecar |
| redis.extraArgs | list | `[]` | Additional command line arguments to pass to redis-server |
| redis.extraContainers | list | `[]` | Additional containers to be added to the redis pod |
@ -976,6 +978,7 @@ server:
| redis.image.tag | string | `"7.0.15-alpine"` | Redis tag |
| redis.imagePullSecrets | list | `[]` (defaults to global.imagePullSecrets) | Secrets with credentials to pull images from a private registry |
| redis.initContainers | list | `[]` | Init containers to add to the redis pod |
| redis.livenessProbe | object | `{"failureThreshold":5,"initialDelaySeconds":30,"periodSeconds":15,"successThreshold":1,"timeoutSeconds":15}` | livenessProbe parameters to pass to the Redis server |
| redis.metrics.enabled | bool | `false` | Deploy metrics service |
| redis.metrics.service.annotations | object | `{}` | Metrics service annotations |
| redis.metrics.service.clusterIP | string | `"None"` | Metrics service clusterIP. `None` makes a "headless service" (no virtual IP) |
@ -1003,6 +1006,7 @@ server:
| redis.podAnnotations | object | `{}` | Annotations to be added to the Redis server pods |
| redis.podLabels | object | `{}` | Labels to be added to the Redis server pods |
| redis.priorityClassName | string | `""` (defaults to global.priorityClassName) | Priority class for redis pods |
| redis.readinessProbe | object | `{"failureThreshold":5,"initialDelaySeconds":30,"periodSeconds":15,"successThreshold":1,"timeoutSeconds":15}` | readinessProbe parameters to pass to the Redis server |
| redis.resources | object | `{}` | Resource limits and requests for redis |
| redis.securityContext | object | See [values.yaml] | Redis pod-level security context |
| redis.service.annotations | object | `{}` | Redis service annotations |

View file

@ -0,0 +1,29 @@
{{/* vim: set filetype=mustache: */}}
{{- define "redis_liveness.sh" }}
response=$(
redis-cli \
-h localhost \
-p {{ .Values.redis.containerPorts.redis }} \
ping
)
if [ "$response" != "PONG" ] && [ "${response:0:7}" != "LOADING" ] ; then
echo "$response"
exit 1
fi
echo "response=$response"
{{- end }}
{{- define "redis_readiness.sh" }}
response=$(
redis-cli \
-h localhost \
-p {{ .Values.redis.containerPorts.redis }} \
ping
)
if [ "$response" != "PONG" ] ; then
echo "$response"
exit 1
fi
echo "response=$response"
{{- end }}

View file

@ -72,6 +72,28 @@ spec:
envFrom:
{{- toYaml . | nindent 8 }}
{{- end }}
livenessProbe:
initialDelaySeconds: {{ .Values.redis.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.redis.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.redis.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.redis.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.redis.livenessProbe.failureThreshold }}
exec:
command:
- sh
- -c
- /health/redis_liveness.sh
readinessProbe:
initialDelaySeconds: {{ .Values.redis.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.redis.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.redis.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.redis.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.redis.readinessProbe.failureThreshold }}
exec:
command:
- sh
- -c
- /health/redis_readiness.sh
ports:
- name: redis
containerPort: {{ .Values.redis.containerPorts.redis }}
@ -82,8 +104,10 @@ spec:
securityContext:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.redis.volumeMounts }}
volumeMounts:
- mountPath: /health
name: health
{{- with .Values.redis.volumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- if .Values.redis.exporter.enabled }}
@ -102,6 +126,24 @@ spec:
- name: metrics
containerPort: {{ .Values.redis.containerPorts.metrics }}
protocol: TCP
livenessProbe:
httpGet:
path: /metrics
port: {{ .Values.redis.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.redis.exporter.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.redis.exporter.livenessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.redis.exporter.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.redis.exporter.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.redis.exporter.livenessProbe.failureThreshold }}
readinessProbe:
httpGet:
path: /metrics
port: {{ .Values.redis.containerPorts.metrics }}
initialDelaySeconds: {{ .Values.redis.exporter.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.redis.exporter.readinessProbe.timeoutSeconds }}
periodSeconds: {{ .Values.redis.exporter.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.redis.exporter.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.redis.exporter.readinessProbe.failureThreshold }}
resources:
{{- toYaml .Values.redis.exporter.resources | nindent 10 }}
{{- with .Values.redis.exporter.containerSecurityContext }}
@ -139,8 +181,12 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.redis.volumes }}
volumes:
- name: health
configMap:
name: {{ include "argo-cd.redis.fullname" . }}-health-configmap
defaultMode: 0755
{{- with .Values.redis.volumes }}
{{- toYaml . | nindent 8}}
{{- end }}
{{- with .Values.redis.dnsConfig }}

View file

@ -0,0 +1,15 @@
{{- $redisHa := index .Values "redis-ha" -}}
{{- if and .Values.redis.enabled (not $redisHa.enabled) -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "argo-cd.redis.fullname" . }}-health-configmap
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.redis.name "name" .Values.redis.name) | nindent 4 }}
data:
redis_liveness.sh: |
{{- include "redis_liveness.sh" . }}
redis_readiness.sh: |
{{- include "redis_readiness.sh" . }}
{{- end }}

View file

@ -1215,6 +1215,22 @@ redis:
drop:
- ALL
# -- livenessProbe parameters to pass to the Redis server
livenessProbe:
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 15
successThreshold: 1
failureThreshold: 5
# -- readinessProbe parameters to pass to the Redis server
readinessProbe:
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 15
successThreshold: 1
failureThreshold: 5
# -- Resource limits and requests for redis-exporter sidecar
resources: {}
# limits:
@ -1244,6 +1260,22 @@ redis:
# - secretRef:
# name: secret-name
# -- livenessProbe parameters to pass to the Redis server
livenessProbe:
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 15
successThreshold: 1
failureThreshold: 5
# -- readinessProbe parameters to pass to the Redis server
readinessProbe:
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 15
successThreshold: 1
failureThreshold: 5
# -- Additional containers to be added to the redis pod
## Note: Supports use of custom Helm templates
extraContainers: []