Introduction
This documents gives an overview to the design and functional implementation for Internal Load Balancing on VPC tiers.
Feature developers:
- APIs and Business logic - Alena Prokharchyk
- Backend - to be assigned
Use case
There are 2 tiers in the VPC - Web tier A and Application tier B. Traffic to Web tier is balanced on the VPC VR on the public side. Admin wants traffic coming from LB to App tier to be balanced as well. Load balancing on the APP tier will be covered by the Internal LB feature.
Glossary
InternalLB - Internal Load Balancer - the container for LBRules. InternalLB is uniquely identified by NetworkId and IpAddress.
LBRule - Load Balancing Rule that gets configured within InternalLB
InternalLBVM - Internal Load Balancer VM - the CS System VM with HA proxy software, where all LB rules are getting configured.
General flow
- Create App tier using network offering with Service=Lb, Provider=ILBVm
- Create Internal Load Balancer - InternalLB1 - on the App tier network. The new InternalLBVM starts up on App tier with the Ip1 automatically acquired from the app tier network.
- Create LBRule1 with lbPort 80 and instancePort 80 in InternalLB1. Nothing gets configured on the backend yet.
- Add vm1 to the LBRule1. The rule for Ip1/VM1/ports 80:80 gets added to the HA proxy config on InternalLBVM
- Add vm2 to the LBRule1. The rule for IP1/VM2/80:80 gets added to the HA proxy config on InternalLBVM
- If you want to manage access from tier A to tier B, setup Network ACLs
The pic below will have following LB rules configured on the VPC:
- InternalLB1 having guest IP 10.10.10.4. InternalLB1 has 2 LB rules - rule #1 lbPort=23, instancePort=25; rule #2 lbPort=45, instancePort=46
- InternalLB2 having guest IP 10.10.10.6. InternalLB2 has 1 LB rule with lbPort=23 and isntancePort=25

Architecture and design description
1) Enable Internal LB on VPC tier
Introduce new Network Provider - InternalLBVm. This provider supports only 1 service - LB
In order to have Internal Load Balancing support on VPC tier, the tier has to be created from the network offering with Service=LB, Provider=InternalLBVm.
Java code changes
- Introduce new Network Element - InternalLBVm. Make it extend LoadBalancingServiceProvider interface.
- Introduce InternalLBNetworkApplianceManager
- Allow to use network offering having LB/InternalLBVm to be used only when create network inside VPC
Backend changes
For the backend engineer to complete. We might need a separate template/set of scripts for this kind of vm, or we might use the existing VR template.
Web Services API
No changes to existing Apis
DB changes
Add one more default Network offering having LB Service with Internal LB provider. Insert this offering as a part of the upgrade as well.
2) Create Internal Load Balancer
Create Internal Load Balancer for the App tier network. The InternalLB is uniquely identified by:
InternalLB creation will trigger IP allocation from Guest network, and span new InternalLBVM
Java code changes
- Add new manager - InternalLoadBalancerManagerImpl (name is TBD). This class will manage Internal Load Balancers.
- A new InternalLBVM should be spanned once the internal load balancer is created. This code should be handled by InternalLoadBalancerNetworkApplianceManager. The VM gets created with 1 NIC having guest IP of the InternalLB
- Might need a new Load Balancer interface.
Backend changes
For the backend engineer to complete. Have to put HA proxy management/configuration details here
Web Services API
New set of APIs to create InternalLB, delete load balancer, list load balancers
Api name |
Request parameters |
Response parameter |
Available to regular user |
createInternalLoadBalancer |
- networkId (required)
- name (required)
- description (required)
|
- id
- name
- description
- networkId
- zoneId
- ipAddress
- type (=Internal)
- list of LBRules (child objects, the list is empty at this point)
|
yes |
deleteLoadBalancer |
|
|
yes |
listLoadBalancers |
- id
- name
- description
- networkId
- zoneId
- ipAddress
- type
|
List of Load Balancer objects, each having:
- id
- name
- description
- networkId
- zoneId
- ipAddress
- type
- list of LBRules (child objects)
|
yes |
DB changes
TBD
3) Add Load Balancing Rule to the Internal Load Balancer created on step #2
Java code changes
- Revise LoadBalancingRulesManagerImpl and see what code can be re-used.
Backend changes
No changes.
Web Services API
New set of APIs to manage Load Balancing rules
API name |
Request parameters |
Response parameters |
Available to regular user |
createLoadBalancingRule |
- loadBalancerId(required)
- algorithm (required)
- loadBalancerPort (required)
- instancePort (required)
|
- id
- loadBalancerId
- algorithm
- loadBalancerPort
- instancePort
- list of VMs assigned to the LBRule
|
yes |
deleteLoadBalancingRule |
|
|
yes |
listLoadBalancingRules |
- id
- loadBalancerId
- algorithm
- loadBalancerPort
- instancePort
|
List of LBRules, each having parameters:
- id
- loadBalancerId
- algorithm
- loadBalancerPort
- instancePort
- list of VMs assigned to the LBRule
|
yes |
DB changes
TBD
4) Assign VM(s) to the Load Balancing Rule.
Web Services API
New set of APIs to assign/remove vms from load balancing rules.
API name |
Request parameters |
Response Parameters |
Available to regular user |
tassignVMToLoadBalancingRule |
- id (required)
- virtualMachineIds(required)
|
|
true |
removeVMFromLoadBalancingRule |
- id (required)
- virtualMachineId (required)
|
|
true |
Internal Load Balancing Vm life cycle
- Create: InternalLBVM gets created when internalLB gets created.
- Destroy: InternalLBVM gets destroyed when internalLB gets removed.
- Reboot: InternalLBVM can be rebooted as a regular system vm using RebootSystemVm API.
- List: InternalLBVM can be listed with ListSystemVMs API
Question: should we allow destroying the vm with DestroySystemVM command?
Limitations
- Internal and Public Lb are mutually exclusive on a tier. If the tier has LB on the public side, then it can't have the Internal LB
- Supported just on VPC networks
UI
TBD