-
Notifications
You must be signed in to change notification settings - Fork 2
/
port-forward.sh
executable file
·18 lines (14 loc) · 954 Bytes
/
port-forward.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
cleanup() {
kill $(jobs -p) 2>/dev/null
}
trap cleanup EXIT
BUYER_V1_POD="$(kubectl get pods --selector app=bookbuyer,version=v1 -n bookbuyer --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
STORE_V1_POD="$(kubectl get pods --selector app=bookstore,version=v1 -n bookstore --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
STORE_V2_POD="$(kubectl get pods --selector app=bookstore,version=v2 -n bookstore --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
#THIEF_V1_POD="$(kubectl get pods --selector app=bookthief,version=v1 -n bookthief --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
kubectl port-forward $BUYER_V1_POD -n bookbuyer 8080:14001 --address 0.0.0.0 &
kubectl port-forward $STORE_V1_POD -n bookstore 8084:14001 --address 0.0.0.0 &
kubectl port-forward $STORE_V2_POD -n bookstore 8082:14001 --address 0.0.0.0 &
#kubectl port-forward $THIEF_V1_POD -n bookthief 8083:14001 --address 0.0.0.0 &
wait