From d1c72678cec81f33ee8c66db373f48d24fc7f787 Mon Sep 17 00:00:00 2001
From: Lluis Gifre <lluis.gifre@cttc.es>
Date: Tue, 4 Oct 2022 10:47:35 +0000
Subject: [PATCH] Monitoring component:

- added wait control while MonitoringDB is starting
---
 deploy.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/deploy.sh b/deploy.sh
index e3c55c9da..b0bd37442 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -190,7 +190,17 @@ for EXTRA_MANIFEST in $TFS_EXTRA_MANIFESTS; do
     printf "\n"
 done
 
-# By now, leave this control here. Some component dependencies are not well handled
+# By now, leave these controls here. Some component dependencies are not well handled.
+
+if [[ "$TFS_COMPONENTS" == *"monitoring"* ]]; then
+    echo "Waiting for 'MonitoringDB' component..."
+    # Kubernetes does not implement --for='condition=available' for statefulsets.
+    # By now, we assume a single replica of monitoringdb. To be updated in future releases.
+    kubectl wait --namespace $TFS_K8S_NAMESPACE \
+        --for=jsonpath='{.status.readyReplicas}'=1 --timeout=300s statefulset/monitoringdb
+    printf "\n"
+fi
+
 for COMPONENT in $TFS_COMPONENTS; do
     echo "Waiting for '$COMPONENT' component..."
     kubectl wait --namespace $TFS_K8S_NAMESPACE \
-- 
GitLab