Add new algorithm SOURCE_IP_PORT
LB_ALGORITHM_SOURCE_IP_PORT is an algorithm used by OVN Load Balancer [0]. This patch adds its support to the API. [0] https://review.opendev.org/#/c/660369 Depends-On: I605f44f0f50219aa003df477de9bae4062f3c308 Change-Id: I436a6e553065d1755d465d20ad36f7ba2cbb8eba Task: 35952 Story: 2006264
This commit is contained in:
parent
f3b48bc2f7
commit
2eac7a7862
@ -909,7 +909,7 @@ l7rules-status-object-list:
|
||||
lb-algorithm:
|
||||
description: |
|
||||
The load balancing algorithm for the pool. One of ``LEAST_CONNECTIONS``,
|
||||
``ROUND_ROBIN``, or ``SOURCE_IP``.
|
||||
``ROUND_ROBIN``, ``SOURCE_IP``, or ``SOURCE_IP_PORT``.
|
||||
in: body
|
||||
required: true
|
||||
type: string
|
||||
|
@ -103,8 +103,8 @@ At a minimum, you must specify these pool attributes:
|
||||
listen. A valid value is ``HTTP``, ``HTTPS``, ``PROXY``, ``TCP``, or ``UDP``.
|
||||
|
||||
- ``lb_algorithm`` The load-balancer algorithm, such as
|
||||
``ROUND_ROBIN``, ``LEAST_CONNECTIONS``, and ``SOURCE_IP``, that
|
||||
distributes traffic to the pool members. The load-balancer
|
||||
``ROUND_ROBIN``, ``LEAST_CONNECTIONS``, ``SOURCE_IP`` and ``SOURCE_IP_PORT``,
|
||||
that distributes traffic to the pool members. The load-balancer
|
||||
provider must support this algorithm.
|
||||
|
||||
- ``listener_id`` The ID of the listener in which this pool
|
||||
@ -144,6 +144,9 @@ specifying the additional elements or attributes in the request.
|
||||
To create a pool, the parent load balancer must have an ``ACTIVE``
|
||||
provisioning status.
|
||||
|
||||
``SOURCE_IP_PORT`` algorithm is available from version 2.13.
|
||||
|
||||
|
||||
.. rest_status_code:: success ../http-status.yaml
|
||||
|
||||
- 201
|
||||
|
@ -755,8 +755,8 @@ contain the following:
|
||||
| healthmonitor | object | A `Healthmonitor object`_. |
|
||||
+-----------------------+--------+------------------------------------------+
|
||||
| lb_algorithm | string | Load balancing algorithm: One of |
|
||||
| | | ROUND_ROBIN, LEAST_CONNECTIONS, or |
|
||||
| | | SOURCE_IP. |
|
||||
| | | ROUND_ROBIN, LEAST_CONNECTIONS, |
|
||||
| | | SOURCE_IP or SOURCE_IP_PORT. |
|
||||
+-----------------------+--------+------------------------------------------+
|
||||
| loadbalancer_id | string | ID of load balancer. |
|
||||
+-----------------------+--------+------------------------------------------+
|
||||
|
@ -62,9 +62,16 @@ driver.ovn=missing
|
||||
|
||||
[operation.lb_algorithm.SOURCE_IP]
|
||||
title=lb_algorithm - SOURCE_IP
|
||||
notes=The pool will direct connections to the member server based on a has of the source IP.
|
||||
notes=The pool will direct connections to the member server based on a hash of the source IP.
|
||||
cli=openstack loadbalancer pool create --lb-algorithm SOURCE_IP --listener <listener>
|
||||
driver.amphora=complete
|
||||
driver.ovn=missing
|
||||
|
||||
[operation.lb_algorithm.SOURCE_IP_PORT]
|
||||
title=lb_algorithm - SOURCE_IP_PORT
|
||||
notes=The pool will direct connections to the member server based on a hash of the source IP and Port.
|
||||
cli=openstack loadbalancer pool create --lb-algorithm SOURCE_IP_PORT --listener <listener>
|
||||
driver.amphora=missing
|
||||
driver.ovn=complete
|
||||
|
||||
[operation.description]
|
||||
|
@ -85,6 +85,9 @@ class RootController(rest.RestController):
|
||||
self._add_a_version(versions, 'v2.11', 'v2', 'SUPPORTED',
|
||||
'2019-06-24T00:00:00Z', host_url)
|
||||
# VIP ACL
|
||||
self._add_a_version(versions, 'v2.12', 'v2', 'CURRENT',
|
||||
self._add_a_version(versions, 'v2.12', 'v2', 'SUPPORTED',
|
||||
'2019-09-11T00:00:00Z', host_url)
|
||||
# SOURCE_IP_PORT algorithm
|
||||
self._add_a_version(versions, 'v2.13', 'v2', 'CURRENT',
|
||||
'2019-09-13T00:00:00Z', host_url)
|
||||
return {'versions': versions}
|
||||
|
@ -0,0 +1,67 @@
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""Add LB_ALGORITHM_SOURCE_IP_PORT
|
||||
|
||||
Revision ID: dcf88e59aae4
|
||||
Revises: da371b422669
|
||||
Create Date: 2019-07-23 12:50:49.722003
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'dcf88e59aae4'
|
||||
down_revision = 'da371b422669'
|
||||
|
||||
|
||||
def migrate_pools():
|
||||
conn = op.get_bind()
|
||||
lb_table = sa.sql.table(
|
||||
'load_balancer',
|
||||
sa.sql.column('id', sa.String),
|
||||
sa.sql.column('provider', sa.String),
|
||||
sa.sql.column('provisioning_status', sa.String))
|
||||
pool_table = sa.sql.table(
|
||||
'pool',
|
||||
sa.sql.column('id', sa.String),
|
||||
sa.sql.column('load_balancer_id', sa.String),
|
||||
sa.sql.column('lb_algorithm', sa.String))
|
||||
|
||||
j = pool_table.join(lb_table,
|
||||
pool_table.c.load_balancer_id == lb_table.c.id)
|
||||
stmt = sa.select([pool_table.c.id]).select_from(j).where(
|
||||
lb_table.c.provider == 'ovn')
|
||||
result = conn.execute(stmt)
|
||||
|
||||
for row in result:
|
||||
stmt = pool_table.update().values(lb_algorithm='SOURCE_IP_PORT').where(
|
||||
pool_table.c.id == row[0])
|
||||
op.execute(stmt)
|
||||
|
||||
|
||||
def upgrade():
|
||||
insert_table = sa.table(
|
||||
u'algorithm',
|
||||
sa.column(u'name', sa.String(255)),
|
||||
)
|
||||
op.bulk_insert(
|
||||
insert_table,
|
||||
[
|
||||
{'name': 'SOURCE_IP_PORT'}
|
||||
]
|
||||
)
|
||||
migrate_pools()
|
@ -43,7 +43,7 @@ class TestRootController(base_db_test.OctaviaDBTestBase):
|
||||
def test_api_versions(self):
|
||||
versions = self._get_versions_with_config()
|
||||
version_ids = tuple(v.get('id') for v in versions)
|
||||
self.assertEqual(13, len(version_ids))
|
||||
self.assertEqual(14, len(version_ids))
|
||||
self.assertIn('v2.0', version_ids)
|
||||
self.assertIn('v2.1', version_ids)
|
||||
self.assertIn('v2.2', version_ids)
|
||||
@ -57,6 +57,7 @@ class TestRootController(base_db_test.OctaviaDBTestBase):
|
||||
self.assertIn('v2.10', version_ids)
|
||||
self.assertIn('v2.11', version_ids)
|
||||
self.assertIn('v2.12', version_ids)
|
||||
self.assertIn('v2.13', version_ids)
|
||||
|
||||
# Each version should have a 'self' 'href' to the API version URL
|
||||
# [{u'rel': u'self', u'href': u'http://localhost/v2'}]
|
||||
|
@ -0,0 +1,16 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
New Load Balancing algorithm SOURCE_IP_PORT has been added.
|
||||
It is supported only by OVN provider driver.
|
||||
upgrade:
|
||||
- |
|
||||
All pools configured under OVN provider driver are
|
||||
automatically migrated to SOURCE_IP_PORT algorithm.
|
||||
Previously algorithm was named as ROUND_ROBIN, but in
|
||||
fact it was not working like ROUND_ROBIN. After
|
||||
investigating, it was observed that core OVN actually
|
||||
utilizes a 5 Tuple Hash/RSS Hash in DPDK/Kernel as a Load
|
||||
Balancing algorithm. The 5 Tuple Hash has Source IP, Destination
|
||||
IP, Protocol, Source Port, Destination Port.
|
||||
To reflect this the name was changed to SOURCE_IP_PORT.
|
Loading…
x
Reference in New Issue
Block a user