#!/usr/bin/env bash export KUBECONFIG=/Users/chrisfu/dev/knoe/knoe-k3s.kubeconfig echo "==> Waiting for gitaly to enter Running state..." for i in $(seq 1 20); do phase=$(kubectl -n gitlab get pod gitlab-gitaly-0 \ -o jsonpath='{.status.containerStatuses[0].state}' 2>/dev/null || true) status=$(kubectl -n gitlab get pod gitlab-gitaly-0 \ --no-headers 2>/dev/null | awk '{print $3}') echo "[$i] status=$status" if [[ "$status" == "Running" ]]; then echo "==> Running! Grabbing logs..." kubectl -n gitlab logs gitlab-gitaly-0 --tail=30 2>&1 | \ grep -v "LD_PRELOAD" | head -30 break fi sleep 5 done echo "==> Last terminated state:" kubectl -n gitlab get pod gitlab-gitaly-0 \ -o jsonpath='{.status.containerStatuses[0].lastState.terminated}' 2>&1 echo "==> Previous logs attempt:" kubectl -n gitlab logs gitlab-gitaly-0 --previous --tail=20 2>&1 | \ grep -v "LD_PRELOAD" | head -25 || true