feat(argo-cd): Add Probes for redis (#2400)
* feat(argo-cd): Add Probes for redis Signed-off-by: François Blondel <francois.blondel@diva-e.com> * fix: redis: move probes scripts from tpl file into configmap Signed-off-by: François Blondel <francois.blondel@diva-e.com> * Version Bump Signed-off-by: François Blondel <francois.blondel@diva-e.com> * feat: set Redis probes optionnal and disabled by default Signed-off-by: François Blondel <francois.blondel@diva-e.com> --------- Signed-off-by: François Blondel <francois.blondel@diva-e.com> Co-authored-by: François Blondel <francois.blondel@diva-e.com>
This commit is contained in:
parent
4a50afcc77
commit
5da598289d
5 changed files with 176 additions and 5 deletions
|
|
@ -72,6 +72,32 @@ spec:
|
|||
envFrom:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.redis.livenessProbe.enabled }}
|
||||
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
|
||||
{{- end }}
|
||||
{{- if .Values.redis.readinessProbe.enabled }}
|
||||
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
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: redis
|
||||
containerPort: {{ .Values.redis.containerPorts.redis }}
|
||||
|
|
@ -82,8 +108,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 +130,28 @@ spec:
|
|||
- name: metrics
|
||||
containerPort: {{ .Values.redis.containerPorts.metrics }}
|
||||
protocol: TCP
|
||||
{{- if .Values.redis.exporter.livenessProbe.enabled }}
|
||||
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 }}
|
||||
{{- end }}
|
||||
{{- if .Values.redis.exporter.readinessProbe.enabled }}
|
||||
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 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.redis.exporter.resources | nindent 10 }}
|
||||
{{- with .Values.redis.exporter.containerSecurityContext }}
|
||||
|
|
@ -139,8 +189,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 }}
|
||||
|
|
|
|||
35
charts/argo-cd/templates/redis/health-configmap.yaml
Normal file
35
charts/argo-cd/templates/redis/health-configmap.yaml
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{{- $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: |
|
||||
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"
|
||||
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 }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue