Skip to content

Commit

Permalink
kubectl-ko: fix missing env-check (#1804)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Aug 15, 2022
1 parent 5613b63 commit 3eb1d1a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions dist/images/kubectl-ko
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ showHelp(){
echo " trace {namespace/podname} {target ip address} {icmp|tcp|udp} [target tcp or udp port] trace ovn microflow of specific packet"
echo " diagnose {all|node} [nodename] diagnose connectivity of all nodes or a specific node"
echo " reload restart all kube-ovn components"
echo " env-check check the environment configuration"
}

# usage: ipv4_to_hex 192.168.0.1
Expand Down Expand Up @@ -667,6 +668,21 @@ reload(){
kubectl rollout status deployment/kube-ovn-monitor -n kube-system
}

env-check(){
set +e

KUBE_OVN_NS=kube-system
podNames=`kubectl get pod --no-headers -n $KUBE_OVN_NS | grep kube-ovn-cni | awk '{print $1}'`
for pod in $podNames
do
nodeName=$(kubectl get pod $pod -n $KUBE_OVN_NS -o jsonpath={.spec.nodeName})
echo "************************************************"
echo "Start environment check for Node $nodeName"
echo "************************************************"
kubectl exec -it -n $KUBE_OVN_NS $pod -c cni-server -- bash /kube-ovn/env-check.sh
done
}

if [ $# -lt 1 ]; then
showHelp
exit 0
Expand Down Expand Up @@ -701,6 +717,9 @@ case $subcommand in
reload)
reload
;;
env-check)
env-check
;;
*)
showHelp
;;
Expand Down

0 comments on commit 3eb1d1a

Please sign in to comment.