Introduction
This documents gives an overview to the design and functional implementation for Internal Load Balancing on VPC tiers.
...
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.
...
The general flow
- Create App tier using network offering with Service=Lb, Provider=ILBVmInteralLBVm
- Acquire guest IP address - Ip1 - from the App tier.
- Create Internal Load Balancer LB1 for Ip1, loadBalancerPort 80, instancePort 80. The new internal LB VM 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 LBRule1LB1. The rule for Ip1/VM1/ports 80:80 gets added to is configured inside the HA proxy config on InternalLBVM
- Add vm2 to the LBRule1LB1. The rule for IP1/VM2/80:80 gets added to the HA proxy config on InternalLBVM80 is configured inside the HA Proxy
- Create Internal Load Balancer LB2 for IP1, loadBalancerPort port 81, instancePort 81. No need to start a new Internal LB vm as it's been already started for IP1.
- 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:
- 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.
- Internal LB rule #1 for InternalLB1 having guest IP 10.10.10.4 . InternalLB1 has 2 LB rules - rule #1 lbPort=23, instancePort=25; rule #2 lbPort=45, instancePort=46guest IP, loadBalancerPort 23 and instancePort 25.
- Internal LB rule #2 for 10.10.10.4 guest IP, loadBalancerPort 45 and instancePort 46.
- Internal LB rule #3 for InternalLB2 having guest IP 10.10.10.6 . InternalLB2 has 1 LB rule with lbPort=23 and isntancePort=25guest IP, loadBalancerPort 23 and instancePort 25.Public LB rule gets configured on the VPC VRInternalLB rules #1 and #2 get configured on Internal LB VM1Internal LB rule #3 gets configured on Internal LB VM2.
Image Modified
Architecture and design description
...
Introduce new Network Provider - InternalLBVm InternalLBVm. This provider supports only 1 service - LB
...
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)
...
Allocate IP address from the VPC Guest Network
Before creating the Internal Load Balancer, the Guest IP address has to be allocated from 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
- New code for allocating and managing IP addresses from the guest network to the account. Might need to create a new manager for that.
...
Backend changes
...
No backend changes are needed for this partFor 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 balancersto allocate guest IP address to the account.
Api name | Request parameters | Response parameter | Available to regular user |
|---|
allocateIpAddress 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 | , accepts only Id of VPC guest networks in 4.2) | - id
- ipAddress
- networkId
- account
- domainId
| yes |
releaseIpAddress deleteLoadBalancer
| id (required) | true/false | yes |
listIpAddresses listLoadBalancers
| - id
- name
- descriptionipAddress
- networkId
- zoneIdaccount
- domainId ipAddress
- type
| List of Load Balancer Ip objects, each having:
- id
- name
- descriptionipAddress
- networkId
- zoneIdaccount
- ipAddress
- type
- list of LBRules (child objects)
- domainId
| yes |
DB changes
TBD
3)
...
Create Internal Load Balancer
...
using the Guest IP address allocated on step #2
Java code changes
- Add new manager - InternalLoadBalancerManagerImpl (name is TBD). This class will manage all the internal lb rules in the system.
- A new InternalLBVM should be spanned when the first LB rule for the IP address gets created. This code should be handled by InternalLBNetworkApplianceManager. The VM gets created with 1 interface having IP address of the Load Balancer assigned to it.
- You can create as many Internal Load Balancers for the IP address as you want. The Internal Load Balancer is uniquely identified by the IpAddress / LbPort combination.
- There is going to be 1 Internal LB vm spanned per IP address participating in the Internal Load Balancing
- Revise LoadBalancingRulesManagerImpl and see what code can be re-used.
...
Backend changes
...
No changes.For the backend engineer to complete. Have to put HA proxy management/configuration details here
Web Services API
...
API name | Request parameters | Response parameters | Available to regular user |
|---|
createInternalLoadBalancer | - ipAddressId(required)
- name (required)
- description
| createLoadBalancingRule | - loadBalancerId (required)
- algorithm (required)
- loadBalancerPort (required)
- instancePort (required)
- networkId (optional)
| - id
- name
- descriptionloadBalancerId
- algorithm
- loadBalancerPort
- instancePortlist of VMs assigned to the LBRule
- networkId
- ipAddress child object
| yes |
deleteLoadBalancingRule deleteInternalLoadBalancer | id(required) | true/false | yes |
listLoadBalancingRules listInternalLoadBalancers | - id
- ipAddressId
- name
- loadBalancerIddescription
- algorithm
- loadBalancerPort
- instancePort
- networkId
| list of load balancers List of LBRules, each having parameters:
- id
- name
- loadBalancerIddescription
- algorithm
- loadBalancerPort
- instancePortlist of VMs assigned to the LBRule
- networkId
- ipAddress child object
| yes |
DB changes
TBD
4) Assign
...
VMs to the Internal Load
...
Balancer.
...
Web Services API
...
New Existing 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 |
will be used for adding/deleting VMs to/from Internal LB
- assignToLoadBalancerRule
- deleteFromLoadBalancerRule
...
Web Services API
...
assignToLoadBalancerRule/deleteFromLoadBalancerRule will accept internal load balancer id when passed with id request parameter.
Internal Load Balancing Vm life cycle
- Create: InternalLBVM gets created when internalLB gets created.the first Load Balancer is created for the IP address
- Destroy: InternalLBVM gets destroyed when internalLB gets removed.the last Load Balancer is removed for the IP address
- 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
...