-
Notifications
You must be signed in to change notification settings - Fork 44
/
terminating
executable file
·28 lines (25 loc) · 740 Bytes
/
terminating
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
#!/usr/bin/env bash
# description: Checks if there are pods terminating
[ -z ${UTILSFILE} ] && source $(echo "$(dirname ${0})/../utils")
error=false
if oc auth can-i get pods -A >/dev/null 2>&1; then
terminating_pods=$(oc get pods -A | grep -c 'Terminating')
if [[ $terminating_pods -ge 1 ]]; then
TERMPODS=$(oc get pods -A | grep 'Terminating')
msg "Pods in Terminating state ($terminating_pods):\n${RED}${TERMPODS}${NOCOLOR}"
errors=$(("${errors}" + 1))
error=true
fi
if [ ! -z "${ERRORFILE}" ]; then
echo $errors >${ERRORFILE}
fi
if [[ $error == true ]]; then
exit ${OCERROR}
else
exit ${OCOK}
fi
else
msg "Couldn't get all pods, check permissions"
exit ${OCSKIP}
fi
exit ${OCUNKNOWNN}