Mirantis/openstack-lbaas

Name: openstack-lbaas

Owner: Mirantis Inc.

Description: Load balancing service for OpenStack

Created: 2012-05-29 21:19:17.0

Updated: 2017-07-21 00:19:38.0

Pushed: 2013-06-10 13:30:34.0

Homepage: null

Size: 3487

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

This is the OpenStack LBaaS project.

Getting started with LBaaS DevBox

LBaaS DevBox is Linux-based VM with pre-installed services to simplify development and testing. It can be downloaded from https://docs.google.com/open?id=0B1mJ0eQoi7tEZmlYWHVyUjA3dlk

DevBox contents:

There are 2 users:

Get LBaaS sources

Log in as “developer”. Then check-out new sources:

rf openstack-lbaas
clone https://github.com/Mirantis/openstack-lbaas.git

Source code layout:

Initial Setup
Make sure the following packeges are installed:

gcc python-dev libsqlite3-dev

Create virtualenv that required for executing code and tests
openstack-lbaas
un_tests -V -f

Note, virtualenv needs to be updated any time code dependencies are changed. Virtualenv is created in .venv folder

Initialize database
venv/bin/python bin/balancer-api --dbsync

The database is located in balancer.sqlite

Intergation with Keystone

Authorization in LBaaS is configured by setting pipeline in balancer-api-paste.ini:

line = authtoken context apiv1app

This line makes Paste.deploy create a pipeline of wsgi filters (see http://pythonpaste.org/wsgifilter/) for request processing.

Default configuration:

line = apiv1app

makes LBaaS work as if every request had admin privileges.

Run and Test
Run LBaaS:
venv/bin/python ./bin/balancer-api --config-file etc/balancer-api-paste.ini --debug

By default the server is started on port 8181

Add HA Proxy device to LBaaS database

Create file createDeviceHAProxy with the following content:


me": "HAP-001",
pe": "HAPROXY",
rsion": "1",
pports_ipv6": 0,
quires_vip_ip": 1,
": "192.168.19.245",
rt": "22",
er": "user",
ssword": "swordfish",
pabilities":

algorithms": ["RoundRobin"],
protocols": ["TCP","HTTP"]


Note: ip needs to be changed to the address of the box where HAProxy is located.

Execute script:

eateDevice.sh HAProxy

If all is right, the information about newly created device will be returned:

vice": {"name": "HAP-001", "has_acl": 1, "ip": "192.168.19.245", "requires_vip_ip": 1, "capabilities": {"algorithms": "RoundRobin"}, "id": "c1dfe0c69bff49d296fc0d613417efcf", "version": "1", "user": "user", "supports_ipv6": 0, "password": "swordfish", "type": "HAPROXY", "port": "22", "supports_vlan": 1}}

Write out value for device/id, it will be used later for creating load balancer

Check that device is added in DB

stDevice.sh
Create load balancer

Create file createLBcommandHAProxy with the following content:


"device_id": "c1dfe0c69bff49d296fc0d613417efcf",
"name": "testLB001",
"protocol": "HTTP",
"transport": "TCP",
"algorithm": "RoundRobin",
"virtualIps": [
    {
        "address": "0.0.0.0",
        "mask": "255.255.255.255",
        "type": "PUBLIC",
        "ipVersion": "IPv4",
        "port": "80",
        "ICMPreply": "True"
    }
],
"nodes": [
    {
        "address": "127.0.0.1",
        "type": "host",
        "port": "8001",
        "weight": "1",
        "minCon": "100",
        "maxCon": "1000",
        "rateBandwidth": "12",
        "rateConnection": "1000",
        "status": "INSERVICE",
        "condition": "ENABLED"
    },
    {
        "address": "127.0.0.1",
        "type": "host",
        "port": "8002",
        "weight": "1",
        "minCon": "300",
        "maxCon": "400",
        "rateBandwidth": "12",
        "rateConnection": "1000",
        "status": "INSERVICE",
        "condition": "ENABLED"
    },
    {
        "address": "127.0.0.1",
        "type": "host",
        "port": "8003",
        "weight": "1",
        "minCon": "300",
        "maxCon": "400",
        "rateBandwidth": "12",
        "rateConnection": "1000",
        "status": "INSERVICE",
        "condition": "ENABLED"
    }
],
"healthMonitor": [
    {
        "type": "ICMP",
        "delay": "15",
        "attemptsBeforeDeactivation": "6",
        "timeout": "20"
    },
    {
        "type": "HTTP",
        "delay": "30",
        "attemptsBeforeDeactivation": "5",
        "timeout": "30",
        "method": "GET",
        "path": "/",
        "expected": "200-204"
    }
]

Configuration above assumes there are three web applications running on the box with HAProxy on ports 8001, 8002, 8003. Change node count or node addresses to whatever you actually have.

Execute script:

eateLB.sh HAProxy

This will deploy HAProxy configuration and restart HAProxy. Note that configuration is added to whatever configuration has been already deployed on the box. In case of issues check the file /etc/haproxy/haproxy.cfg on the box with HAProxy

Check the load balancer
 http://haproxy_ip:port/

HAProxy should return page content from backend nodes.

Developers Documentation

Docs can be built by the following commands:

oc
mpile_docs.sh

To view docs, open doc/html/index.html in the browser.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.