elektra
elektra copied to clipboard
Networking: Change the logic that auto-selects a fip network for new projects
Currently the way this is implemented is that we essentially have a hard-coded list of network name candidates that we try to fetch one after the other until we get a network that matches the name. We try this in a specific order (highest number first, because that is the newest network with the most available fips). However it requires us to add a new highest number whenever a new network is added.
Proposal to fix this: Fetch all networks (maybe it's even possible nowadays to fetch with wildcard), then filter them with a regex (for the name match) and pick the one with the highest number at the end.
The current implementation can be found here: https://github.com/sapcc/elektra/blob/master/plugins/networking/app/services/service_layer/networking_services/network.rb#L71-L89