diff --git a/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl b/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl index 71a2b6bf29..fb8123bc6e 100644 --- a/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl @@ -37,9 +37,14 @@ done tunnel_interface="{{- .Values.network.interface.tunnel -}}" if [ -z "${tunnel_interface}" ] ; then - # search for interface with default routing - # If there is not default gateway, exit - tunnel_interface=$(ip -4 route list 0/0 | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1 + # search for interface with tunnel network routing + tunnel_network_cidr="{{- .Values.network.interface.tunnel_network_cidr -}}" + if [ -z "${tunnel_network_cidr}" ] ; then + tunnel_network_cidr="0/0" + fi + # If there is not tunnel network gateway, exit + tunnel_interface=$(ip -4 route list ${tunnel_network_cidr} | awk -F 'dev' '{ print $2; exit }' \ + | awk '{ print $1 }') || exit 1 fi # determine local-ip dynamically based on interface provided but only if tunnel_types is not null diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl index 4dfb0ffd4c..b9c4b78d65 100644 --- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl @@ -51,9 +51,14 @@ done tunnel_interface="{{- .Values.network.interface.tunnel -}}" if [ -z "${tunnel_interface}" ] ; then - # search for interface with default routing - # If there is not default gateway, exit - tunnel_interface=$(ip -4 route list 0/0 | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1 + # search for interface with tunnel network routing + tunnel_network_cidr="{{- .Values.network.interface.tunnel_network_cidr -}}" + if [ -z "${tunnel_network_cidr}" ] ; then + tunnel_network_cidr="0/0" + fi + # If there is not tunnel network gateway, exit + tunnel_interface=$(ip -4 route list ${tunnel_network_cidr} | awk -F 'dev' '{ print $2; exit }' \ + | awk '{ print $1 }') || exit 1 fi # determine local-ip dynamically based on interface provided but only if tunnel_types is not null diff --git a/neutron/values.yaml b/neutron/values.yaml index 5ab4ca120b..836807e4f2 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -91,10 +91,11 @@ network: # debugging. This feature requires mount propagation support. share_namespaces: true interface: - # Tunnel interface will be used for VXLAN tunneling. If null - # (default) there is a fallback mechanism to search for interface - # with default routing. + # Tunnel interface will be used for VXLAN tunneling. tunnel: null + # If tunnel is null there is a fallback mechanism to search + # for interface with routing using tunnel network cidr. + tunnel_network_cidr: "0/0" sriov: # To perform setup of network interfaces using the SR-IOV init # container you can use a section similar to: