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 8b2df58 commit ddcdfb9
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions dist/images/kubectl-ko
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ showHelp(){
echo " tcpdump {namespace/podname} [tcpdump options ...] capture pod traffic"
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 " env-check check the environment configuration"
echo " tuning {install-fastpath|local-install-fastpath|remove-fastpath|install-stt|local-install-stt|remove-stt} {centos7|centos8}} [kernel-devel-version] deploy kernel optimisation components to the system"
echo " reload restart all kube-ovn components"
}
Expand Down Expand Up @@ -825,13 +826,27 @@ reload(){
kubectl rollout status deployment/kube-ovn-monitor -n kube-system
}

env-check(){
set +e

KUBE_OVN_NS=kube-system
podNames=`kubectl get pod -n $KUBE_OVN_NS -l app=kube-ovn-cni -o 'jsonpath={.items[*].metadata.name}'`
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
else
subcommand="$1"; shift
fi

subcommand="$1"; shift

getOvnCentralPod

case $subcommand in
Expand Down Expand Up @@ -862,7 +877,10 @@ case $subcommand in
tuning)
tuning "$@"
;;
env-check)
env-check
;;
*)
showHelp
showHelp
;;
esac

0 comments on commit ddcdfb9

Please sign in to comment.