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 4c24811 commit e57021f
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 @@ -23,6 +23,7 @@ showHelp(){
echo " diagnose {all|node} [nodename] diagnose connectivity of all nodes or a specific node"
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"
echo " env-check check the environment configuration"
}

# usage: ipv4_to_hex 192.168.0.1
Expand Down Expand Up @@ -825,6 +826,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 @@ -862,6 +878,9 @@ case $subcommand in
tuning)
tuning "$@"
;;
env-check)
env-check
;;
*)
showHelp
;;
Expand Down

0 comments on commit e57021f

Please sign in to comment.