Skip to content

Commit

Permalink
Update kubectl-ko
Browse files Browse the repository at this point in the history
Support commands:ovs-dpctl,ovs-ofctl and ovs-appctl of openvswitch
  • Loading branch information
Yan Wei committed Feb 3, 2021
1 parent d289aa9 commit 473cdc4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dist/images/kubectl-ko
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ showHelp(){
echo " nbctl [ovn-nbctl options ...] invoke ovn-nbctl"
echo " sbctl [ovn-sbctl options ...] invoke ovn-sbctl"
echo " vsctl {nodeName} [ovs-vsctl options ...] invoke ovs-vsctl on selected node"
echo " ofctl {nodeName} [ovs-ofctl options ...] invoke ovs-ofctl on selected node"
echo " dpctl {nodeName} [ovs-dpctl options ...] invoke ovs-dpctl on selected node"
echo " appctl {nodeName} [ovs-appctl options ...] invoke ovs-appctl on selected node"
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"
Expand Down Expand Up @@ -140,15 +143,16 @@ trace(){
esac
}

vsctl(){
xxctl(){
subcommand="$1"; shift
nodeName="$1"; shift
kubectl get no "$nodeName" > /dev/null
ovsPod=$(kubectl get pod -n $KUBE_OVN_NS -o wide | grep " $nodeName " | grep ovs-ovn | awk '{print $1}')
if [ -z "$ovsPod" ]; then
echo "ovs pod doesn't exist on node $nodeName"
exit 1
fi
kubectl exec "$ovsPod" -n $KUBE_OVN_NS -- ovs-vsctl "$@"
kubectl exec "$ovsPod" -n $KUBE_OVN_NS -- ovs-$subcommand "$@"
}

diagnose(){
Expand Down Expand Up @@ -287,8 +291,8 @@ case $subcommand in
sbctl)
kubectl exec "$OVN_SB_POD" -n $KUBE_OVN_NS -c ovn-central -- ovn-sbctl "$@"
;;
vsctl)
vsctl "$@"
vsctl|ofctl|dpctl|appctl)
xxctl "$subcommand" "$@"
;;
tcpdump)
tcpdump "$@"
Expand Down

0 comments on commit 473cdc4

Please sign in to comment.