Skip to content

Commit

Permalink
scripts: catch / retry in connect_logging.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Aug 5, 2024
1 parent 59e0e63 commit 6f8f895
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions resources/scripts/connect_logging.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/bin/bash
set -e
# NO `set -e` here so an error does not exit the script

POD_NAME=$(kubectl get pods --namespace warnet-logging -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=loki-grafana" -o jsonpath="{.items[0].metadata.name}")

echo "Go to http://localhost:3000"
echo "Grafana pod name: ${POD_NAME}"

kubectl --namespace warnet-logging port-forward "${POD_NAME}" 3000
while true; do
echo "Attempting to start Grafana port forwarding"
kubectl --namespace warnet-logging port-forward "${POD_NAME}" 3000 2>&1
echo "Grafana port forwarding exited with status: $?"
sleep 5
done;

echo "warnet-logging port-forward exited"

0 comments on commit 6f8f895

Please sign in to comment.