What container/service creates external load balancer rules in Docker for Azure?

One of the useful features of Docker for Azure is that when you deploy a swarm service in the container cluster, the Docker for Azure services would automatically create a load balancer rule to route public traffic to the service (using the same port as published on the swarm service).
However, we want to change the way these load balancer rules are created. We need to do this so that we can introduce multi-tenancy, by mapping specific service endpoints to specific public IP & ports.

In order for us to customize the behaviour of how load balancer rules are created, we need to understand what Docker4x container is responsible for creating those load balancer rules, understand how it does that and then create our own version of the service (if we cannot reconfigure the existing one to do what we want).

Can anyone help us on where we can find this information?

Hi @francoisnel The container that performs the LB configuration is docker4x/l4controller-azure named as editions_controller. The one running on the leader node checks for any new services that have published a port and if that port is not yet present in the Azure LB, it configures a rule for it. You can see the core swarm side polling logic implemented here in Infrakit: https://github.com/docker/infrakit/tree/master/pkg/controller

The docker4x/l4controller-azure uses very similar code as the above in the Docker4Azure along with the fact that the service port poller is hooked up to the Azure APIs to publish the ports on the Azure LB.

You will also need to stop the editions_controller and have your own take effect. For that, you can simply execute: swarm-exec docker run -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -e containername=editions_controller docker4x/stopcontainer:latest