mirror of
https://github.com/marcel-dempers/docker-development-youtube-series.git
synced 2025-06-06 17:01:30 +00:00
Update redis-statefulset.yaml
Create FDQN for Redis dynamicly
This commit is contained in:
parent
f8ac773d6a
commit
10aad91e3f
@ -22,6 +22,7 @@ spec:
|
|||||||
cp /tmp/redis/redis.conf /etc/redis/redis.conf
|
cp /tmp/redis/redis.conf /etc/redis/redis.conf
|
||||||
|
|
||||||
echo "finding master..."
|
echo "finding master..."
|
||||||
|
MASTER_FDQN=`hostname -f | sed -e 's/redis-[0-9]\./redis-0./'`
|
||||||
if [ "$(redis-cli -h sentinel -p 5000 ping)" != "PONG" ]; then
|
if [ "$(redis-cli -h sentinel -p 5000 ping)" != "PONG" ]; then
|
||||||
echo "master not found, defaulting to redis-0"
|
echo "master not found, defaulting to redis-0"
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ spec:
|
|||||||
echo "this is redis-0, not updating config..."
|
echo "this is redis-0, not updating config..."
|
||||||
else
|
else
|
||||||
echo "updating redis.conf..."
|
echo "updating redis.conf..."
|
||||||
echo "slaveof redis-0.redis.redis.svc.cluster.local 6379" >> /etc/redis/redis.conf
|
echo "slaveof $MASTER_FDQN 6379" >> /etc/redis/redis.conf
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "sentinel found, finding master"
|
echo "sentinel found, finding master"
|
||||||
@ -82,4 +83,4 @@ spec:
|
|||||||
targetPort: 6379
|
targetPort: 6379
|
||||||
name: redis
|
name: redis
|
||||||
selector:
|
selector:
|
||||||
app: redis
|
app: redis
|
||||||
|
Loading…
x
Reference in New Issue
Block a user