Creating custom load balancer flavors

Load balancer flavors are predefined sets of provider configuration options. They are defined per provider driver and expose the unique capabilities of each provider.

By default, there are two load balancer flavors:

  • ACTIVE_STANDBY is used to build highly available load balancers with two instances
  • SINGLE is used to build load balancers with single instances

If needed, administrators can add more flavors for self-service users.

Prerequisites

To create a load balancer flavor

  1. List the load balancer provider capabilities and choose those that will be configured in the flavor. As we use the amphora provider, run:

    # openstack --insecure loadbalancer provider capability list amphora
    +-------------------+-------------------------------+---------------------------------------------------+
    |type               | name                          | description                                       |
    +-------------------+-------------------------------+---------------------------------------------------+
    | flavor            | loadbalancer_topology         | The load balancer topology. One of:               |
    |                   |                               | SINGLE - One amphora per load balancer.           |
    |                   |                               | ACTIVE_STANDBY - Two amphora per load balancer.   |
    | flavor            | compute_flavor                | The compute driver flavor ID.                     |
    | flavor            | amp_image_tag                 | The amphora image tag.                            |
    | flavor            | amp_bdm_delete_on_termination | Delete on termination the amphora block device    |
    |                   |                               | mapping.                                          |
    | availability_zone | compute_zone                  | The compute availability zone.                    |
    | availability_zone | management_network            | The management network ID for the amphora.        |
    | availability_zone | valid_vip_networks            | List of network IDs that are allowed for VIP use. |
    |                   |                               | This overrides/replaces the list of allowed       |
    |                   |                               | networks configured in `octavia.conf`.            |
    +-------------------+-------------------------------+---------------------------------------------------+
  2. List the current compute flavors to learn their IDs:

    # openstack --insecure flavor list
    +-----+--------+-------+------+-----------+-------+-----------+
    | ID  | Name   |   RAM | Disk | Ephemeral | VCPUs | Is Public |
    +-----+--------+-------+------+-----------+-------+-----------+
    | 100 | tiny   |   512 |    0 |         0 |     1 | True      |
    | 101 | small  |  2048 |    0 |         0 |     1 | True      |
    | 102 | medium |  4096 |    0 |         0 |     2 | True      |
    | 103 | large  |  8192 |    0 |         0 |     4 | True      |
    | 104 | xlarge | 16384 |    0 |         0 |     8 | True      |
    +-----+--------+-------+------+-----------+-------+-----------+
    
  3. Create a flavor profile that is responsible for the load balancer topology and associated with a compute flavor. Load balancers use the same compute flavor as virtual machines. For example, to create a flavor profile that will build highly available load balancers with the small flavor, run:

    # openstack --insecure loadbalancer flavorprofile create --name amphora-ha-small --provider amphora  \
    --flavor-data '{"loadbalancer_topology": "ACTIVE_STANDBY", "compute_flavor": "101"}'
    +---------------+----------------------------------------------------------------------+
    | Field         | Value                                                                |
    +---------------+----------------------------------------------------------------------+
    | id            | a1c7d342-df30-490d-b3ec-29d36ff1b0ba                                 |
    | name          | amphora-ha-small                                                     |
    | provider_name | amphora                                                              |
    | flavor_data   | {"loadbalancer_topology": "ACTIVE_STANDBY", "compute_flavor": "101"} |
    +---------------+----------------------------------------------------------------------+
    

    In this case, the created flavor profile will use the default amphora image configured for the load balancing service (refer to Provisioning load balancers). To use a custom amphora image, you need to associate it with the flavor profile by specifying the image tag with amp_image_tag. Note that an image with this tag must exist in the compute cluster (refer to Changing the default load balancer image). For example, to create a flavor profile that will build highly available load balancers with the small flavor and the custom_amphora image, run:

    # openstack --insecure loadbalancer flavorprofile create --name amphora-ha-small --provider amphora  \
    --flavor-data '{"loadbalancer_topology": "ACTIVE_STANDBY", "compute_flavor": "101", "amp_image_tag": "custom_amphora"}'

    The created flavor profile will appear in the vinfra service compute load-balancer flavorprofile list output:

    # vinfra service compute load-balancer flavorprofile list
    +--------------------------------------+--------------------+
    | id                                   | name               |
    +--------------------------------------+--------------------+
    | 0347cfa1-d471-466e-8ed3-b52e41c47140 | amphora-single     |
    | a1c7d342-df30-490d-b3ec-29d36ff1b0ba | amphora-ha-small   |
    | d91d5113-38ad-4a93-951a-36e53be6555a | amphora-act-stndby |
    +--------------------------------------+--------------------+
  4. Create a load balancer flavor using the new flavor profile. For example:

    # openstack --insecure loadbalancer flavor create --name HA-SMALL --enable --flavorprofile amphora-ha-small
    +-------------------+--------------------------------------+
    | Field             | Value                                |
    +-------------------+--------------------------------------+
    | id                | b8b84c9e-7a15-4693-8a06-20ddb1faa75e |
    | name              | HA-SMALL                             |
    | flavor_profile_id | a1c7d342-df30-490d-b3ec-29d36ff1b0ba |
    | enabled           | True                                 |
    | description       |                                      |
    +-------------------+--------------------------------------+
    

The new load balancer flavor will appear in the vinfra service compute load-balancer flavor list output:

# vinfra service compute load-balancer flavor list
+--------------------------------------+----------------+--------------------------------------+---------+
| id                                   | name           | flavor_profile_id                    | enabled |
+--------------------------------------+----------------+--------------------------------------+---------+
| 7ea31357-f9db-4414-b2b2-f0799ebdf356 | ACTIVE_STANDBY | d91d5113-38ad-4a93-951a-36e53be6555a | True    |
| a68c6434-7672-4d3f-91c9-f109bbc7fb75 | SINGLE         | 0347cfa1-d471-466e-8ed3-b52e41c47140 | True    |
| b8b84c9e-7a15-4693-8a06-20ddb1faa75e | HA-SMALL       | a1c7d342-df30-490d-b3ec-29d36ff1b0ba | True    |
+--------------------------------------+----------------+--------------------------------------+---------+

Now, you can use the new flavor for creating load balancers in the self-service panel.