From 578c19fe60efb183ec7645ce512b95f2ca59d20e Mon Sep 17 00:00:00 2001 From: Eliise S Date: Sun, 15 Mar 2020 15:29:15 +0000 Subject: [PATCH] Add waiting for prom in port-forwarding --- hack/portforwards.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hack/portforwards.sh b/hack/portforwards.sh index 7fbc0a7..8b7d363 100755 --- a/hack/portforwards.sh +++ b/hack/portforwards.sh @@ -4,16 +4,23 @@ ps aux | grep [k]ubectl | awk '{print $2}' | xargs kill > /dev/null 2>&1 echo "-------> Verify all pods up" -echo "-------> Wait for Operator to be ready" + # Ensure there are no Databricks Operator pods not in the Ready state +echo "-------> Wait for Operator to be ready" JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n azure-databricks-operator-system -lcontrol-plane=controller-manager get pods -o jsonpath="$JSONPATH" 2>&1 | grep -q -v "Ready=False"; do sleep 5;echo "--------> waiting for all operators to be Ready"; kubectl get pods -n azure-databricks-operator-system; done -echo "-------> Wait for MockAPI to be ready" + # Ensure there are no MockAPI pods not in the Ready state +echo "-------> Wait for MockAPI to be ready" JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n databricks-mock-api -lapp=databricks-mock-api get pods -o jsonpath="$JSONPATH" 2>&1 | grep -q -v "Ready=fALSE"; do sleep 5;echo "--------> waiting for all mocks to be Ready"; kubectl get pods -n databricks-mock-api; done + # Ensure there are no locust pods not in the Ready state echo "-------> Wait for locust to be ready" JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n locust get pods -lapp=locust-loadtest -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 5;echo "--------> waiting for locust to be available"; kubectl get pods -n locust; done +# Ensure there are no prometheus pods not in the Ready state +echo "-------> Wait for prometheus to be ready" +JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n default get pods -lapp=prometheus -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 5;echo "--------> waiting for prometheus to be available"; kubectl get pods -n default; done + echo "-------> Open port-forwards" kubectl port-forward service/prom-azure-databricks-operator-grafana -n default 8080:80 & kubectl port-forward service/prom-azure-databricks-oper-prometheus -n default 9091:9090 &