Skip to content

Commit

Permalink
fix check
Browse files Browse the repository at this point in the history
Signed-off-by: bobz965 <zhangbingbing2_yewu@cmss.chinamobile.com>
  • Loading branch information
bobz965 committed Apr 19, 2024
1 parent 0b595d1 commit d6abc88
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dist/images/check-kube-ovn-pod-restarts.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
set -eux

restartsPods=$(kubectl get po -A -o wide | grep -E "kube-ovn-controller|kube-ovn-pinger|kube-ovn-monitor|kube-ovn-cni|ovn-central|ovs-ovn" | grep -v "Running 0" | wc -l)
restartsPods=$(kubectl get po -A -o wide | grep -E "kube-ovn-controller|kube-ovn-pinger|kube-ovn-monitor|kube-ovn-cni|ovn-central|ovs-ovn" | awk '{print $4$5}' | grep -c "Running0")

if [ $restartsPods -gt 0 ]; then
if [ "$restartsPods" -gt 0 ]; then
echo "some ovn related pods are not running"
kubectl get po -A -o wide | grep -E "kube-ovn-controller|kube-ovn-pinger|kube-ovn-monitor|kube-ovn-cni|ovn-central|ovs-ovn" | grep -v "Running 0"
kubectl get po -A -o wide | grep -E "kube-ovn-controller|kube-ovn-pinger|kube-ovn-monitor|kube-ovn-cni|ovn-central|ovs-ovn"
firstBadPod=$(kubectl get po -A -o wide | grep -E "kube-ovn-controller|kube-ovn-pinger|kube-ovn-monitor|kube-ovn-cni|ovn-central|ovs-ovn" | grep -v "Running 0" | head -n1 | awk '{print $1 " " $2}')
kubectl logs -p -n $firstBadPod | tail -n 100
echo "PLEASE CHECK THE ERROR LOGS ABOVE /|\/|\/|\/|\ "
kubectl logs -p -n "$firstBadPod" | tail -n 100
echo "PLEASE CHECK THE ERROR LOGS ABOVE /|\ /|\ /|\ "
exit 1
fi

0 comments on commit d6abc88

Please sign in to comment.