diff --git a/kuryr_kubernetes/cni/binding/bridge.py b/kuryr_kubernetes/cni/binding/bridge.py index e9d0c669f..f86a89913 100644 --- a/kuryr_kubernetes/cni/binding/bridge.py +++ b/kuryr_kubernetes/cni/binding/bridge.py @@ -43,10 +43,18 @@ class BaseBridgeDriver(health.HealthHandler): with h_ipdb.interfaces[host_ifname] as h_iface: h_iface.remove() + if vif.network.mtu: + interface_mtu = vif.network.mtu + else: + LOG.info("Default mtu %(mtu)s is used for interface, " + "for mtu of network if configured with 0", + {"mtu": CONF.neutron_defaults.network_device_mtu}) + interface_mtu = CONF.neutron_defaults.network_device_mtu + with b_base.get_ipdb(netns) as c_ipdb: with c_ipdb.create(ifname=ifname, peer=host_ifname, kind='veth') as c_iface: - c_iface.mtu = vif.network.mtu + c_iface.mtu = interface_mtu c_iface.address = str(vif.address) c_iface.up() @@ -56,7 +64,7 @@ class BaseBridgeDriver(health.HealthHandler): with b_base.get_ipdb() as h_ipdb: with h_ipdb.interfaces[host_ifname] as h_iface: - h_iface.mtu = vif.network.mtu + h_iface.mtu = interface_mtu h_iface.up() def disconnect(self, vif, ifname, netns): diff --git a/kuryr_kubernetes/config.py b/kuryr_kubernetes/config.py index 0c6dc2d5f..a858b9c49 100644 --- a/kuryr_kubernetes/config.py +++ b/kuryr_kubernetes/config.py @@ -170,6 +170,9 @@ neutron_defaults = [ cfg.StrOpt('external_svc_subnet', help=_("Optional external subnet ID for Kubernetes services"), default=None), + cfg.IntOpt('network_device_mtu', + help='Default MTU setting for network interface.', + default=1500,), ] octavia_defaults = [