Introduction

This documents gives an overview to the design and functional implementation for Internal Load Balancing on VPC tiers.

Feature developers:

Glossary

Use case

There are 2 tiers in the VPC - Web tier and Application tier. Traffic to Web tier is balanced on the VPC VR on the public side. User wants traffic coming from Web to the App tier to be balanced as well. Load balancing on the App tier will be covered by the Internal LB feature.

Internal LB can be handled by 2 network providers:

The pic below is for the case when InternalLBVm is used as a provider for the LB service on internal tier:

  1. Public LB rule for 72.52.125.10 Public IP, public port 80 and private port 81. It enables LB for traffic coming from the internet to the vms on the Web tier. The LB rule is configured on the VPC VR.
  2. Internal LB rule #1 for 10.10.10.4 guest IP, loadBalancerPort 23 and instancePort 25. The LB rule is configured on InternalLBVM1.
  3. Internal LB rule #2 for 10.10.10.4 guest IP, loadBalancerPort 45 and instancePort 46. The LB rule is configured on InternalLBVM1.
  4. Internal LB rule #3 for 10.10.10.6 guest IP, loadBalancerPort 23 and instancePort 25. The LB rule is configured on InternalLBVM2.

General flow

1) Enable Internal LB on VPC tier

In order to have Internal Load Balancing support on VPC tier, the tier has to be created from the network offering with:

or

Java code changes

Backend changes

Existing VR template will be used by the Internal LB vm. The same HA proxy settings as on the regular VR, will be setup on the Internal LB vm. 

Web Services API

Changes to existing Apis: list/createNetworkOffering APIs will return new parameters in the response - internal_lb and public_lb:. The parameters' type is boolean.

New APIs:

Api Name

Request Parameters

Response parameters

Available to regular user

createInternalLoadBalancerElement

nspid(required) - network service provider UUID

  • id
  • nspid
  • enabled
  • type (always has value of internal_lb_vm)

no

configureInternalLoadBalancerElement

  • id (required) - id of the element
  • enabled(required, boolean) 

the same response as of createInternalLoadBalancerElement

no

listInternalLoadBalancerElements

  • id
  • nspid
  • enabled

the same response as of createInternalLoadBalancerElement

no


no

DB changes

2) Create Load Balancer Rule 

Java code changes

If provider is InternalLBVM:

Netscaler VPX:

Backend changes

Internal LB vm: the same HA proxy configuration as on the regular VR, will be used on the Internal LB vm. QA, use the same methods for verifying if the LB rules are set on the backend as you do when test VR.

Web Services API

Introduce new APIs

API Name

Request Parameters

Response parameters

Available to regular user

createLoadBalancer 

  • name (required, unique) - name of the LB
  • displayText (required) - display text of the LB
  • networkId (required) - the guest network id the Load Balancer belongs to. 
  • sourceIpAddressNetworkId (required) - the Guest network Id where sourceIp address of the LB belongs to.
  • sourceIpAddress (optional) - source IP address. Has to be specified with sourceIpNetworkId. If not specified, the IP address will be required from the network
  • scheme (required) - supported values Internal/Public
  • algorithm (required)
  • sourcePort (required)
  • instancePort (required)

LoadBalancer object:
* id

  • name
  • displayText
  • networkId
  • algorithm
  • sourceIpAddressNetworkId
  • sourceIpAddress
  • scheme (Public/Internal)
  • list of LoadBalancerRules objects
  • list of LoadBalancerInstance objects
    LoadBalancerRule object:
  • sourcePort
  • instancePort
    LoadBalancerInstance object:
  • instanceId
  • instanceName

yes

deleteLoadBalancer

  • id (required) - load balancer id
  • true/false

yes

listLoadBalancers

  • id
  • name
  • networkId
  • sourceIpAddressNetworkId
  • sourceIpAddress
  • scheme

list of LoadBalancer objects (see the structure in createLoadBalancer command description)

yes

DB changes

3) Attach VM to the Load Balancer

Existing API are going to be used to assign/remove vm to/from the load balancer

assignToLoadBalancerRule

assignToLoadBalancerRule

Internal Load Balancing rules management in Network

For Public LB rule, whenever a new LB rule is created, we re-send all the existing LB rules for the network, to the network elements. It would be a bit different when it comes to managing Internal LB rules.

How to list Guest IP addresses allocated for LB purpose

At the moment, cloudStack doesn't expose any API for listing IP addresses from the guest network. You see all the ip addresses allocated by the load balancers by executing the following command:

listLoadBalancers&scheme=Internal&networkId=<Id of the network the load balancer belongs to>

Internal Load Balancing Vm management and life cycle

1) The InternalLBVM will be created with 2 interfaces: eth0 - linkLocal (private in VMWare case), eth1 - the IP address of the LB rule. The vm will get created from the Virtual Router template and Service offering named "System Offering For Internal LB VM". If you want to use another service offering for internal lb creation, change the global config "internallbvm.service.offering" from NULL value to not NULL valid service offering id.

2) InternalLBVM will be managed by InternalLoadBalancerVMManager

3) InternalLBVM life cycle:

4) To stop/start/list internal lb vm, use new stop/start/listInternalLoadBalancer API commands.

Web Services API

ApiName

RequestParameters

ResponseParameters

AvailableToRegularUser

stopInternalLoadBalancerVM

id(required)
force(optional, defaulted to false if not specified)

internalloadbalancervm object having parameters (the same parameters regular VR vm has):
id
zoneId
zoneName
zoneType
dns1
dns2
networkdomain
name
podid
hostId
state
account/domainId
serviceOfferingId/serviceOfferingName

no

startInternalLoadBalancerVM

id(required)

the same as the above

no

listInternalLoadBalancerVMs

id - list by id
name - list by name
podId - list by podId the internal LB vm belongs to
hostId - list by hostId where internal LB VM runs
state - list by state
zoneId - list by zoneId
vpcId - list by VPC id
forVpc (boolean) - list only internal LB vms that belong to vpc

the same as the above

no

DB Changes

As a part of the DB upgrade, following needs to be done:

Limitations

UI

TBD