From 0e6268d26ded8e6ac364dcc370991d4b17a88d3f Mon Sep 17 00:00:00 2001
From: "egon w. stemle" <egon@iiegn.eu>
Date: Tue, 23 Jul 2019 22:50:57 +0200
Subject: [PATCH] Add initContainers as dependency check

Lately, we encountered hick-ups when the dspace container comes up but
the postgres container is still missing (although the containers will
restart until both start in the right order).

Here we add one `initContainers` that will poll the postgres db until
success.

Address #60
---
 kubernetes/dspace-deployment.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kubernetes/dspace-deployment.yaml b/kubernetes/dspace-deployment.yaml
index 557f890..7cdf8a8 100644
--- a/kubernetes/dspace-deployment.yaml
+++ b/kubernetes/dspace-deployment.yaml
@@ -18,6 +18,12 @@ spec:
       labels:
         io.kompose.service: dspace
     spec:
+      initContainers:
+      - image: postgres
+        name: clarin-dspace-check-db-ready
+        command: ['sh', '-c',
+          'until pg_isready -h postgres -p 5432;
+          do echo waiting for database; sleep 2; done;']
       containers:
       - env:
         - name: DSPACE_USER
-- 
GitLab