Skip to content

Commit

Permalink
Fix statefulsets mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalii Agapov committed Oct 22, 2024
1 parent 23ed45e commit 9e7ec4c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions check_kubernetes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ usage() {
exit 2
}

VERSION="v1.3.1"
VERSION="v1.3.2"

TIMEOUT=15
unset NAME
Expand Down Expand Up @@ -660,15 +660,17 @@ mode_statefulsets() {
jq -r ".items[] | select(.metadata.namespace==\"$ns\") | \
.metadata.name"))
fi
for rs in "${statefulsets[@]}"; do
for sts in "${statefulsets[@]}"; do
declare -A statusArr
while IFS="=" read -r key value; do
statusArr[$key]="$value"
done < <(echo "$data" | \
jq -r ".items[] | select(.metadata.namespace==\"$ns\" and .metadata.name==\"$rs\") | \
jq -r ".items[] | select(.metadata.namespace==\"$ns\" and .metadata.name==\"$sts\") | \
.status | to_entries | map(\"\(.key)=\(.value)\") | .[]")
OUTPUT="${OUTPUT}Statefulset $ns/$rs ${statusArr[readyReplicas]}/${statusArr[currentReplicas]} ready\n"
if [ "${statusArr[readyReplicas]}" != "${statusArr[currentReplicas]}" ]; then
if [ "$EXITCODE" == 0 ]; then
OUTPUT="Statefulset $ns/$sts ${statusArr[availableReplicas]}/${statusArr[currentReplicas]} ready\n"
fi
if [ "${statusArr[availableReplicas]}" != "${statusArr[currentReplicas]}" ]; then
((count_failed++))
EXITCODE=2
else
Expand Down

0 comments on commit 9e7ec4c

Please sign in to comment.