112 lines
3.2 KiB
YAML
112 lines
3.2 KiB
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: {{ include "common.names.fullname" . }}-scripts
|
|
namespace: {{ .Release.Namespace }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if .Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
data:
|
|
ping_readiness_local.sh: |-
|
|
#!/bin/sh
|
|
set -e
|
|
|
|
REDIS_STATUS_FILE=/tmp/.redis_cluster_check
|
|
|
|
{{- if .Values.usePasswordFile }}
|
|
password_aux=`cat ${REDIS_PASSWORD_FILE}`
|
|
export REDISCLI_AUTH=$password_aux
|
|
{{- else }}
|
|
if [ ! -z "$REDIS_PASSWORD" ]; then export REDISCLI_AUTH=$REDIS_PASSWORD; fi;
|
|
{{- end }}
|
|
response=$(
|
|
timeout -s 3 $1 \
|
|
redis-cli \
|
|
-h localhost \
|
|
{{- if .Values.tls.enabled }}
|
|
-p $REDIS_TLS_PORT \
|
|
--tls \
|
|
--cert {{ template "redis-cluster.tlsCert" . }} \
|
|
--key {{ template "redis-cluster.tlsCertKey" . }} \
|
|
--cacert {{ template "redis-cluster.tlsCACert" . }} \
|
|
{{- else }}
|
|
-p $REDIS_PORT \
|
|
{{- end }}
|
|
ping
|
|
)
|
|
if [ "$?" -eq "124" ]; then
|
|
echo "Timed out"
|
|
exit 1
|
|
fi
|
|
if [ "$response" != "PONG" ]; then
|
|
echo "$response"
|
|
exit 1
|
|
fi
|
|
{{- if not .Values.cluster.externalAccess.enabled }}
|
|
if [ ! -f "$REDIS_STATUS_FILE" ]; then
|
|
response=$(
|
|
timeout -s 3 $1 \
|
|
redis-cli \
|
|
-h localhost \
|
|
{{- if .Values.tls.enabled }}
|
|
-p $REDIS_TLS_PORT \
|
|
--tls \
|
|
--cert {{ template "redis-cluster.tlsCert" . }} \
|
|
--key {{ template "redis-cluster.tlsCertKey" . }} \
|
|
--cacert {{ template "redis-cluster.tlsCACert" . }} \
|
|
{{- else }}
|
|
-p $REDIS_PORT \
|
|
{{- end }}
|
|
CLUSTER INFO | grep cluster_state | tr -d '[:space:]'
|
|
)
|
|
if [ "$?" -eq "124" ]; then
|
|
echo "Timed out"
|
|
exit 1
|
|
fi
|
|
if [ "$response" != "cluster_state:ok" ]; then
|
|
echo "$response"
|
|
exit 1
|
|
else
|
|
touch "$REDIS_STATUS_FILE"
|
|
fi
|
|
fi
|
|
{{- end }}
|
|
ping_liveness_local.sh: |-
|
|
#!/bin/sh
|
|
set -e
|
|
|
|
{{- if .Values.usePasswordFile }}
|
|
password_aux=`cat ${REDIS_PASSWORD_FILE}`
|
|
export REDISCLI_AUTH=$password_aux
|
|
{{- else }}
|
|
if [ ! -z "$REDIS_PASSWORD" ]; then export REDISCLI_AUTH=$REDIS_PASSWORD; fi;
|
|
{{- end }}
|
|
response=$(
|
|
timeout -s 3 $1 \
|
|
redis-cli \
|
|
-h localhost \
|
|
{{- if .Values.tls.enabled }}
|
|
-p $REDIS_TLS_PORT \
|
|
--tls \
|
|
--cert {{ template "redis-cluster.tlsCert" . }} \
|
|
--key {{ template "redis-cluster.tlsCertKey" . }} \
|
|
--cacert {{ template "redis-cluster.tlsCACert" . }} \
|
|
{{- else }}
|
|
-p $REDIS_PORT \
|
|
{{- end }}
|
|
ping
|
|
)
|
|
if [ "$?" -eq "124" ]; then
|
|
echo "Timed out"
|
|
exit 1
|
|
fi
|
|
responseFirstWord=$(echo $response | head -n1 | awk '{print $1;}')
|
|
if [ "$response" != "PONG" ] && [ "$responseFirstWord" != "LOADING" ] && [ "$responseFirstWord" != "MASTERDOWN" ]; then
|
|
echo "$response"
|
|
exit 1
|
|
fi
|