Skip to content

Commit

Permalink
Merge pull request #670 from yanwei2019/patch-3
Browse files Browse the repository at this point in the history
Update kubectl-ko
  • Loading branch information
oilbeater committed Feb 4, 2021
2 parents 600802c + 8b833ee commit a0196d8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
12 changes: 8 additions & 4 deletions dist/images/install-pre-1.16.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,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 @@ -1973,15 +1976,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 @@ -2121,8 +2125,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
12 changes: 8 additions & 4 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1882,6 +1882,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 @@ -2011,15 +2014,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 @@ -2159,8 +2163,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
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 a0196d8

Please sign in to comment.