Skip to content

Commit

Permalink
kubectl-ko: fix trace when u2oInterconnection is enabled (#2836)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed May 24, 2023
1 parent 6ee56d0 commit 2068d87
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dist/images/kubectl-ko
Expand Up @@ -301,7 +301,8 @@ trace(){

local vlan=$(kubectl get subnet "$ls" -o jsonpath={.spec.vlan})
local logicalGateway=$(kubectl get subnet "$ls" -o jsonpath={.spec.logicalGateway})
if [ ! -z "$vlan" -a "$logicalGateway" != "true" ]; then
local u2oIC=$(kubectl get subnet "$ls" -o jsonpath={.spec.u2oInterconnection})
if [ ! -z "$vlan" -a "$logicalGateway" != "true" -a "$u2oIC" != "true" ]; then
gateway=$(kubectl get subnet "$ls" -o jsonpath={.spec.gateway})
if [[ "$gateway" =~ .*,.* ]]; then
if [ "$af" = "4" ]; then
Expand Down Expand Up @@ -358,12 +359,12 @@ trace(){
fi

if [ -z "$dstMac" ]; then
echo "Using the gateway mac address as destination"
echo "Using the logical gateway mac address as destination"
local lr=$(kubectl get "$typedName" $optNamespace -o jsonpath={.metadata.annotations.ovn\\.kubernetes\\.io/logical_router})
if [ -z "$lr" ]; then
lr=$(kubectl get subnet "$ls" -o jsonpath={.spec.vpc})
fi
dstMac=$(kubectl exec $OVN_NB_POD -n $KUBE_OVN_NS -c ovn-central -- ovn-nbctl --data=bare --no-heading --columns=mac find logical_router_port name="$lr"-"$ls" | tr -d '\r')
dstMac=$(kubectl exec $OVN_NB_POD -n $KUBE_OVN_NS -c ovn-central -- ovn-nbctl --data=bare --no-heading --columns=mac find logical_router_port name="$lr-$ls" | tr -d '\r')
fi

if [ -z "$dstMac" ]; then
Expand Down

0 comments on commit 2068d87

Please sign in to comment.