Files

22 lines
566 B
Bash
Executable File

#!/bin/sh
# Reconnect the loopback tunnel after the API pod is replaced during restart tests.
set -eu
: "${KUBE_CONTEXT:=dev}" "${NAMESPACE:=highload-applications}"
LOCAL_PORT=${LOCAL_PORT:-8083}
child=
cleanup() {
if [ -n "$child" ]; then
kill "$child" 2>/dev/null || true
wait "$child" 2>/dev/null || true
fi
exit 0
}
trap cleanup INT TERM
while :; do
kubectl --context "$KUBE_CONTEXT" -n traefik port-forward service/traefik "$LOCAL_PORT:80" --address 127.0.0.1 &
child=$!
wait "$child" || true
child=
sleep 1
done