-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
To Reproduce
Steps to reproduce the behavior:
livenessProbe:
exec:
command:
- /bin/sh
- /usr/local/bin/healthcheck.sh
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
name: dragonfly
ports:
- containerPort: 6379
name: redis
protocol: TCP
- containerPort: 9999
name: admin
protocol: TCP
readinessProbe:
exec:
command:
- /bin/sh
- /usr/local/bin/healthcheck.sh
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
and
cat /usr/local/bin/healthcheck.sh
#!/bin/sh
HOST="localhost"
PORT=$HEALTHCHECK_PORT
if [ -z "$HEALTHCHECK_PORT" ]; then
DF_NET=$(netstat -tlnp | grep "1/dragonfly")
if [ -z "$DF_NET" ]; then
# if we failed, then lets try the priveleged version. is triggerred by the regular command:
# docker run docker.dragonflydb.io/dragonflydb/dragonfly
DF_NET=$(su dfly -c "netstat -tlnp" | grep "1/dragonfly")
fi
PORT=$(echo $DF_NET | grep -oE ':[0-9]+' | cut -c2- | tail -n 1)
fi
_healthcheck="nc -q1 $HOST $PORT"
echo PING | ${_healthcheck}
exit $?

