Specify gateway for multiple spaces

I am trying to deploy a container with multiple interfaces connected to 2 separate spaces. My cloud is a MAAS cloud and the host machine has been configured correctly with both spaces and the correct gateway. When I deploy an application to that machine with 2 spaces such as:

juju deploy mysql --to lxd:0 --constraints “spaces=a,b” --series xenial

The container is built correctly but the default gateway is set to the first gateway MAAS returns (https://github.com/juju/juju/blob/develop/cloudconfig/cloudinit/network_ubuntu.go#L227). Is there any way for me to specify use the default gateway from space b?

I’ve heard rumor there will be support for multi-gateway networking in future releases of MAAS.

This was talked about during a recent sprint and I know we’ll be looking to make sure Juju supports what they do there.

@manadart @sparkiegeek

Bumping this issue as it was brought up on IRC - do we now have a solution we can point to?

This also affects multi-NIC on OpenStack - the default gateway depends on what comes up first, which causes issues with network policy.

#1829150 is in the same orbit.

We do not have a mechanism to specify the default gateway at present.

@manadart what about using the cloud init run script “backdoor” to set it up?