k8s/cartservice: add init container to wait redis

otherwise nullpointerexception persists

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan 2018-07-02 12:41:33 -07:00
parent 2a251779e6
commit 3416aee7d5

View file

@ -8,6 +8,20 @@ spec:
labels:
app: cartservice
spec:
terminationGracePeriodSeconds: 5
initContainers:
- name: wait-redis
image: redis:alpine
command: ['sh', '-c', 'set -x;
until timeout -t 5 redis-cli -h "${REDIS_HOST}" -p "${REDIS_PORT}" ping; do
echo "waiting for redis at ${REDIS_HOST}:${REDIS_PORT}...";
sleep 2;
done;']
env:
- name: REDIS_HOST
value: "redis-cart"
- name: REDIS_PORT
value: "6379"
containers:
- name: server
image: cartservice