diff --git a/kuryr_libnetwork/controllers.py b/kuryr_libnetwork/controllers.py index c0b6b785..dfb0c62e 100644 --- a/kuryr_libnetwork/controllers.py +++ b/kuryr_libnetwork/controllers.py @@ -1396,7 +1396,8 @@ def network_driver_join(): "SrcName": iface_name, "DstPrefix": config.CONF.binding.veth_dst_prefix }, - "StaticRoutes": [] + "StaticRoutes": [], + "DisableGatewayService": True, } for subnet in all_subnets: @@ -1725,7 +1726,12 @@ def ipam_request_address(): if is_gateway: # check if request gateway ip same with existed gateway ip existed_gateway_ip = subnet.get('gateway_ip', '') - if req_address == existed_gateway_ip: + if not req_address: + if subnet['ip_version'] == 4: + allocated_address = "0.0.0.0/0" + else: + allocated_address = "::/0" + elif req_address == existed_gateway_ip: allocated_address = '{}/{}'.format(req_address, subnet_cidr.prefixlen) else: diff --git a/kuryr_libnetwork/tests/unit/test_kuryr.py b/kuryr_libnetwork/tests/unit/test_kuryr.py index ac338cd0..a77dae0f 100644 --- a/kuryr_libnetwork/tests/unit/test_kuryr.py +++ b/kuryr_libnetwork/tests/unit/test_kuryr.py @@ -2179,7 +2179,8 @@ class TestKuryr(base.TestKuryrBase): 'DstPrefix': config.CONF.binding.veth_dst_prefix, 'SrcName': fake_iface_name, }, - 'StaticRoutes': [] + 'StaticRoutes': [], + 'DisableGatewayService': True } self.assertEqual(200, response.status_code) @@ -2296,7 +2297,8 @@ class TestKuryr(base.TestKuryrBase): 'DstPrefix': config.CONF.binding.veth_dst_prefix, 'SrcName': fake_iface_name, }, - 'StaticRoutes': [] + 'StaticRoutes': [], + 'DisableGatewayService': True } self.assertEqual(200, response.status_code) @@ -2405,7 +2407,8 @@ class TestKuryr(base.TestKuryrBase): fake_v4_subnet['subnet']['host_routes'][0]['nexthop'], 'Destination': fake_v4_subnet['subnet']['host_routes'][0]['destination'], - 'RouteType': constants.ROUTE_TYPE['NEXTHOP']}] + 'RouteType': constants.ROUTE_TYPE['NEXTHOP']}], + 'DisableGatewayService': True } self.assertEqual(200, response.status_code)