Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 14d457b

Browse files
authored
Merge pull request #4911 from shashankram/rel-v1.2
[backport] demo/scripts: fix bookstore app label and container name (#4910)
2 parents f5f3603 + 9749020 commit 14d457b

7 files changed

+23
-39
lines changed

demo/deploy-bookstore.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ spec:
9090
containers:
9191
- image: "${CTR_REGISTRY}/bookstore:${CTR_TAG}"
9292
imagePullPolicy: Always
93-
name: $SVC
93+
name: bookstore
9494
ports:
9595
- containerPort: 14001
9696
name: web
@@ -133,10 +133,10 @@ spec:
133133
- name: $CTR_REGISTRY_CREDS_NAME
134134
EOF
135135

136-
kubectl get pods --no-headers -o wide --selector app="$SVC" -n "$BOOKSTORE_NAMESPACE"
137-
kubectl get endpoints --no-headers -o wide --selector app="$SVC" -n "$BOOKSTORE_NAMESPACE"
136+
kubectl get pods --no-headers -o wide --selector app=bookstore,version="$VERSION" -n "$BOOKSTORE_NAMESPACE"
137+
kubectl get endpoints --no-headers -o wide --selector app=bookstore,version="$VERSION" -n "$BOOKSTORE_NAMESPACE"
138138
kubectl get service -o wide -n "$BOOKSTORE_NAMESPACE"
139139

140-
for x in $(kubectl get service -n "$BOOKSTORE_NAMESPACE" --selector app="$SVC" --no-headers | awk '{print $1}'); do
140+
for x in $(kubectl get service -n "$BOOKSTORE_NAMESPACE" --selector app=bookstore,version="$VERSION" --no-headers | awk '{print $1}'); do
141141
kubectl get service "$x" -n "$BOOKSTORE_NAMESPACE" -o jsonpath='{.status.loadBalancer.ingress[*].ip}'
142142
done

demo/tail-bookstore-envoy.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# shellcheck disable=SC1091
44
source .env
55

6-
backend="$1"
6+
selector="$1"
77
thisScript="$(dirname "$0")/$(basename "$0")"
88

9-
if [ -z "$backend" ]; then
10-
echo "Usage: $thisScript <backend-name>"
9+
if [ -z "$selector" ]; then
10+
echo "Usage: $thisScript <selector>"
1111
exit 1
1212
fi
1313

14-
POD="$(kubectl get pods -n "$BOOKSTORE_NAMESPACE" --show-labels --selector app="$backend" --no-headers | grep -v 'Terminating' | awk '{print $1}' | head -n1)"
14+
POD="$(kubectl get pods -n "$BOOKSTORE_NAMESPACE" --show-labels --selector "$selector" --no-headers | grep -v 'Terminating' | awk '{print $1}' | head -n1)"
1515

1616
kubectl logs "$POD" -n "$BOOKSTORE_NAMESPACE" -c envoy --tail=100 -f

demo/tail-bookstore.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# shellcheck disable=SC1091
44
source .env
55

6-
backend="$1"
6+
selector="$1"
77
thisScript="$(dirname "$0")/$(basename "$0")"
88

9-
if [ -z "$backend" ]; then
10-
echo "Usage: $thisScript <backend-name>"
9+
if [ -z "$selector" ]; then
10+
echo "Usage: $thisScript <selector>"
1111
exit 1
1212
fi
1313

14-
POD="$(kubectl get pods -n "$BOOKSTORE_NAMESPACE" --show-labels --selector app="$backend" --no-headers | grep -v 'Terminating' | awk '{print $1}' | head -n1)"
14+
POD="$(kubectl get pods -n "$BOOKSTORE_NAMESPACE" --show-labels --selector "$selector" --no-headers | grep -v 'Terminating' | awk '{print $1}' | head -n1)"
1515

16-
kubectl logs "$POD" -n "$BOOKSTORE_NAMESPACE" -c "$backend" --tail=100
16+
kubectl logs "$POD" -n "$BOOKSTORE_NAMESPACE" -c bookstore --tail=100

scripts/port-forward-bookstore-ui-v1.sh

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,7 @@
77
# shellcheck disable=SC1091
88
source .env
99

10-
backend="${1:-bookstore-v1}"
11-
thisScript="$(dirname "$0")/$(basename "$0")"
12-
13-
if [ -z "$backend" ]; then
14-
echo "Usage: $thisScript <backend-name>"
15-
exit 1
16-
fi
17-
1810
BOOKSTOREv1_LOCAL_PORT="${BOOKSTOREv1_LOCAL_PORT:-8081}"
19-
POD="$(kubectl get pods --selector app="$backend" -n "$BOOKSTORE_NAMESPACE" --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
11+
POD="$(kubectl get pods --selector app=bookstore,version=v1 -n "$BOOKSTORE_NAMESPACE" --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
2012

2113
kubectl port-forward "$POD" -n "$BOOKSTORE_NAMESPACE" "$BOOKSTOREv1_LOCAL_PORT":14001

scripts/port-forward-bookstore-ui-v2.sh

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,7 @@
77
# shellcheck disable=SC1091
88
source .env
99

10-
backend="${1:-bookstore-v2}"
11-
thisScript="$(dirname "$0")/$(basename "$0")"
12-
13-
if [ -z "$backend" ]; then
14-
echo "Usage: $thisScript <backend-name>"
15-
exit 1
16-
fi
17-
1810
BOOKSTOREv2_LOCAL_PORT="${BOOKSTOREv2_LOCAL_PORT:-8082}"
19-
POD="$(kubectl get pods --selector app="$backend" -n "$BOOKSTORE_NAMESPACE" --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
11+
POD="$(kubectl get pods --selector app=bookstore,version=v2 -n "$BOOKSTORE_NAMESPACE" --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
2012

2113
kubectl port-forward "$POD" -n "$BOOKSTORE_NAMESPACE" "$BOOKSTOREv2_LOCAL_PORT":14001

scripts/port-forward-bookstore-ui.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
# shellcheck disable=SC1091
88
source .env
99

10-
backend="${1:-bookstore}"
10+
selector="$1"
1111
thisScript="$(dirname "$0")/$(basename "$0")"
1212

13-
if [ -z "$backend" ]; then
14-
echo "Usage: $thisScript <backend-name>"
13+
if [ -z "$selector" ]; then
14+
echo "Usage: $thisScript <selector>"
1515
exit 1
1616
fi
1717

1818
BOOKSTORE_LOCAL_PORT="${BOOKSTORE_LOCAL_PORT:-8084}"
19-
POD="$(kubectl get pods --selector app="$backend" -n "$BOOKSTORE_NAMESPACE" --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
19+
POD="$(kubectl get pods --selector "$selector" -n "$BOOKSTORE_NAMESPACE" --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
2020

2121
kubectl port-forward "$POD" -n "$BOOKSTORE_NAMESPACE" "$BOOKSTORE_LOCAL_PORT":14001

scripts/port-forward-bookstore.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
# shellcheck disable=SC1091
33
source .env
44

5-
backend="$1"
5+
selector="$1"
66
thisScript="$(dirname "$0")/$(basename "$0")"
77

8-
if [ -z "$backend" ]; then
9-
echo "Usage: $thisScript <backend-name>"
8+
if [ -z "$selector" ]; then
9+
echo "Usage: $thisScript <selector>"
1010
exit 1
1111
fi
1212

13-
POD="$(kubectl get pods --selector app="$backend" -n "$BOOKSTORE_NAMESPACE" --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
13+
POD="$(kubectl get pods --selector "$selector" -n "$BOOKSTORE_NAMESPACE" --no-headers | grep 'Running' | awk 'NR==1{print $1}')"
1414
kubectl port-forward "$POD" -n "$BOOKSTORE_NAMESPACE" 15000:15000
1515

0 commit comments

Comments
 (0)