107 lines
3.1 KiB
YAML
107 lines
3.1 KiB
YAML
|
# Source: calckey/charts/redis/templates/health-configmap.yaml
|
||
|
apiVersion: v1
|
||
|
kind: ConfigMap
|
||
|
metadata:
|
||
|
name: calckey-redis-health
|
||
|
namespace: "default"
|
||
|
labels:
|
||
|
app.kubernetes.io/name: redis
|
||
|
helm.sh/chart: redis-16.13.2
|
||
|
app.kubernetes.io/instance: calckey
|
||
|
app.kubernetes.io/managed-by: Helm
|
||
|
data:
|
||
|
ping_readiness_local.sh: |-
|
||
|
#!/bin/bash
|
||
|
|
||
|
[[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
|
||
|
[[ -n "$REDIS_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_PASSWORD"
|
||
|
response=$(
|
||
|
timeout -s 3 $1 \
|
||
|
redis-cli \
|
||
|
-h localhost \
|
||
|
-p $REDIS_PORT \
|
||
|
ping
|
||
|
)
|
||
|
if [ "$?" -eq "124" ]; then
|
||
|
echo "Timed out"
|
||
|
exit 1
|
||
|
fi
|
||
|
if [ "$response" != "PONG" ]; then
|
||
|
echo "$response"
|
||
|
exit 1
|
||
|
fi
|
||
|
ping_liveness_local.sh: |-
|
||
|
#!/bin/bash
|
||
|
|
||
|
[[ -f $REDIS_PASSWORD_FILE ]] && export REDIS_PASSWORD="$(< "${REDIS_PASSWORD_FILE}")"
|
||
|
[[ -n "$REDIS_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_PASSWORD"
|
||
|
response=$(
|
||
|
timeout -s 3 $1 \
|
||
|
redis-cli \
|
||
|
-h localhost \
|
||
|
-p $REDIS_PORT \
|
||
|
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
|
||
|
ping_readiness_master.sh: |-
|
||
|
#!/bin/bash
|
||
|
|
||
|
[[ -f $REDIS_MASTER_PASSWORD_FILE ]] && export REDIS_MASTER_PASSWORD="$(< "${REDIS_MASTER_PASSWORD_FILE}")"
|
||
|
[[ -n "$REDIS_MASTER_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_MASTER_PASSWORD"
|
||
|
response=$(
|
||
|
timeout -s 3 $1 \
|
||
|
redis-cli \
|
||
|
-h $REDIS_MASTER_HOST \
|
||
|
-p $REDIS_MASTER_PORT_NUMBER \
|
||
|
ping
|
||
|
)
|
||
|
if [ "$?" -eq "124" ]; then
|
||
|
echo "Timed out"
|
||
|
exit 1
|
||
|
fi
|
||
|
if [ "$response" != "PONG" ]; then
|
||
|
echo "$response"
|
||
|
exit 1
|
||
|
fi
|
||
|
ping_liveness_master.sh: |-
|
||
|
#!/bin/bash
|
||
|
|
||
|
[[ -f $REDIS_MASTER_PASSWORD_FILE ]] && export REDIS_MASTER_PASSWORD="$(< "${REDIS_MASTER_PASSWORD_FILE}")"
|
||
|
[[ -n "$REDIS_MASTER_PASSWORD" ]] && export REDISCLI_AUTH="$REDIS_MASTER_PASSWORD"
|
||
|
response=$(
|
||
|
timeout -s 3 $1 \
|
||
|
redis-cli \
|
||
|
-h $REDIS_MASTER_HOST \
|
||
|
-p $REDIS_MASTER_PORT_NUMBER \
|
||
|
ping
|
||
|
)
|
||
|
if [ "$?" -eq "124" ]; then
|
||
|
echo "Timed out"
|
||
|
exit 1
|
||
|
fi
|
||
|
responseFirstWord=$(echo $response | head -n1 | awk '{print $1;}')
|
||
|
if [ "$response" != "PONG" ] && [ "$responseFirstWord" != "LOADING" ]; then
|
||
|
echo "$response"
|
||
|
exit 1
|
||
|
fi
|
||
|
ping_readiness_local_and_master.sh: |-
|
||
|
script_dir="$(dirname "$0")"
|
||
|
exit_status=0
|
||
|
"$script_dir/ping_readiness_local.sh" $1 || exit_status=$?
|
||
|
"$script_dir/ping_readiness_master.sh" $1 || exit_status=$?
|
||
|
exit $exit_status
|
||
|
ping_liveness_local_and_master.sh: |-
|
||
|
script_dir="$(dirname "$0")"
|
||
|
exit_status=0
|
||
|
"$script_dir/ping_liveness_local.sh" $1 || exit_status=$?
|
||
|
"$script_dir/ping_liveness_master.sh" $1 || exit_status=$?
|
||
|
exit $exit_status
|