-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_pods.sh
More file actions
executable file
·34 lines (28 loc) · 1.07 KB
/
check_pods.sh
File metadata and controls
executable file
·34 lines (28 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
NAMESPACE="$ns"
if [[ "$NAMESPACE" == "" ]]; then
NAMESPACE=default
fi
if [[ "$APP_NAME" == "" ]]; then
APP_NAME=redis
fi
if [[ "$RELEASE" == "" ]]; then
RELEASE="secure-doc-management"
fi
export POD=$(kubectl get pods --namespace $NAMESPACE -l "app.kubernetes.io/name=$APP_NAME,app.kubernetes.io/instance=$RELEASE" -o jsonpath="{.items[0].metadata.name}")
export READY=$(kubectl get pod $POD -o jsonpath='{.status.containerStatuses[0].ready}')
echo "Checking pod $POD of"
echo " RELEASE=$RELEASE APP_NAME=$APP_NAME, NAMESPACE=$NAMESPACE"
echo " READY STATUS=$READY"
I=0
while [[ "$READY" != "true" ]] ; do
((I=I+1))
if [[ $I -ge 128 ]] ; then
echo "Giving up waiting for $POD to become 'ready'"
exit 1
fi
sleep 5
export POD=$(kubectl get pods --namespace $NAMESPACE -l "app.kubernetes.io/name=$APP_NAME,app.kubernetes.io/instance=$RELEASE" -o jsonpath="{.items[0].metadata.name}")
export READY=$(kubectl get pod $POD -o jsonpath='{.status.containerStatuses[0].ready}')
echo "- POD=$POD, READY STATUS=$READY"
done