Skip to content

Commit

Permalink
add drift detection to check-k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
ogrand committed Feb 5, 2025
1 parent 498e244 commit 5bddfec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/scripts/check-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ checkClusterResources() {
printf "\n%bREADY SUSP. KIND NAMESPACE/NAME%b\n${result}\n" "${GREEN}" "${STD}"
fi

#--- Check drift events
result="$(kubectl events -A --types=Warning --no-headers=true | grep " DriftDetected " | sed -e "s+.* DriftDetected + DriftDetected +g" | awk '{printf "%-15s %s\n", $1, $2}' | sort)"
if [ "${result}" != "" ] ; then
printf "\n%bSTATUS KIND%b\n${result}\n" "${GREEN}" "${STD}"
fi

#--- Check pending services
pending_services="$(kubectl get svc -A --context ${context} --request-timeout=1s --no-headers=true 2>&1 | grep " LoadBalancer " | grep -E "<none>|<pending>" | awk '{print $1"/"$2}')"
if [ "${pending_services}" != "" ] ; then
Expand Down

0 comments on commit 5bddfec

Please sign in to comment.