Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl-ko: fix missing env-check #1804

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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