Skip to content

Commit 9e7ec4c

Browse files
author
Vitalii Agapov
committed
Fix statefulsets mode
1 parent 23ed45e commit 9e7ec4c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

check_kubernetes.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ usage() {
5858
exit 2
5959
}
6060

61-
VERSION="v1.3.1"
61+
VERSION="v1.3.2"
6262

6363
TIMEOUT=15
6464
unset NAME
@@ -660,15 +660,17 @@ mode_statefulsets() {
660660
jq -r ".items[] | select(.metadata.namespace==\"$ns\") | \
661661
.metadata.name"))
662662
fi
663-
for rs in "${statefulsets[@]}"; do
663+
for sts in "${statefulsets[@]}"; do
664664
declare -A statusArr
665665
while IFS="=" read -r key value; do
666666
statusArr[$key]="$value"
667667
done < <(echo "$data" | \
668-
jq -r ".items[] | select(.metadata.namespace==\"$ns\" and .metadata.name==\"$rs\") | \
668+
jq -r ".items[] | select(.metadata.namespace==\"$ns\" and .metadata.name==\"$sts\") | \
669669
.status | to_entries | map(\"\(.key)=\(.value)\") | .[]")
670-
OUTPUT="${OUTPUT}Statefulset $ns/$rs ${statusArr[readyReplicas]}/${statusArr[currentReplicas]} ready\n"
671-
if [ "${statusArr[readyReplicas]}" != "${statusArr[currentReplicas]}" ]; then
670+
if [ "$EXITCODE" == 0 ]; then
671+
OUTPUT="Statefulset $ns/$sts ${statusArr[availableReplicas]}/${statusArr[currentReplicas]} ready\n"
672+
fi
673+
if [ "${statusArr[availableReplicas]}" != "${statusArr[currentReplicas]}" ]; then
672674
((count_failed++))
673675
EXITCODE=2
674676
else

0 commit comments

Comments
 (0)