On Tue, Oct 25, 2011 at 5:20 PM, Tim Fletcher <[email protected]> wrote:
> Hi folks, > Hi. > > I've been trying to add support for the [Brightbox load balancer > API][1] to libcloud, and there's a bit of a mismatch between the two > models. > > [1]: https://api.gb1.brightbox.com/1.0/#load_balancer > > From what I can tell from reading through the code, the libcloud model > is that a load balancer has a public IP, a single port number, and it > balances traffic between multiple "members" (i.e. servers), each of > which has a public IP and a single port number. Is that correct? > Correct. > > There are several key differences between this and the Brightbox > model: a Brightbox load balancer can have multiple ports open; > Our current abstraction is designed so each LoadBalancer instance can only balance across members on a single port. Changing this would require pretty major changes to the loadbalancer API. Looking at the other provider APIs, a single balancer instance supporting balancing across members on multiple ports also doesn't seem like a common use case so I don't think it fits into Libcloud (I'm still open to suggestions though and someone could possible convince me otherwise). Keep in mind that Libcloud is by definition a lowest common denominator which means we need to sacrifice some not-so-common functionality to make an API which works with a lot of providers. > Brightbox servers don't necessarily have a public IP (they can be > attached to a load balancer without one); Your implementation could for example subclass base "Member" class[1] and implement constructor in a way so it only takes a single argument - node id. Implementing "balancer_attach_compute_node" and "balancer_dettach_compute_node"[2] also shouldn't be too bad. In the base driver implementation this method just reads the first public address from the Node object when constructing a Member object. Your driver could override those two methods and make them read Node object id when creating a Member object. > and the ports for Brightbox > servers behind a load balancer have to be the same (the port mapping > is specified on the load balancer). > > I'm unsure how to tackle this. Is it possible to generalise the > libcloud load balancer abstraction to support the Brightbox API > somehow? > > Cheers, > Tim > [1]: http://libcloud.apache.org/apidocs/0.5.2/libcloud.loadbalancer.base.Member.html [2]: http://libcloud.apache.org/apidocs/0.5.2/libcloud.loadbalancer.base.Driver.html#balancer_attach_compute_node
