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:
parent
2a251779e6
commit
3416aee7d5
1 changed files with 14 additions and 0 deletions
|
@ -8,6 +8,20 @@ spec:
|
||||||
labels:
|
labels:
|
||||||
app: cartservice
|
app: cartservice
|
||||||
spec:
|
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:
|
containers:
|
||||||
- name: server
|
- name: server
|
||||||
image: cartservice
|
image: cartservice
|
||||||
|
|
Loading…
Reference in a new issue