3.5 KiB
Database Changes
Many GSLB backends have specific parameters for load-balancer policies. Instead of just being a CNAME record in a DNS server as expected with the Neutron LBaaS + Designate solution.
Also at time there is not just one Pool associated with a load-balancer policy, there could be more than one. Like Active and Passive for disaster recovery. So we need to move the pool-id out of loadbalancer table and make it a separate relational table.
Problem description
There is a requirement for introduction of loadbalancer_parameters in to the kosmos database as some GSLB backends have specific attributes associated with a GSLB Policy. As current kosmos database schema doesn't accomodate parameters for load_balancer, we need to add a new table named, load_balancer_parameters for this.
We also need to take pool_id from load_balancer table as there could be more than one pool associated with a policy. For example Active/Standy policies would always have a standby pool that should be defined for the policy.
domain_id in all the artifact table will be modified to accept null so that we implement only if required.
Proposed change
We need to make changes to the following:
db/tables.py
- Add a new table loadbalancer_parameters with the following columns:
-
- loadbalancer_id [FK from loadbalancers table]
- parameter_key [Type: String(255)]
- prameter_value [Type: String(255)]
Remove pool_id from loadbalancers table
- Add a new table loadbalancer_pools with the following columns:
-
- loadbalancer_id [FK from loadbalancers table]
- pool_id [FK from pools table]
- loadbalancer_pool_type [Type: LB_POOL_TYPES; Default: ACTIVE]
- Add
LB_POOL_TYPES
as an enum with the following possible values: -
ACTIVE
PASSIVE
- Remove
domain_id
from the following tables: -
- pools
- pool_members
- loadbalancers
- monitors
Alter the flavour_id
in the loadbalancer table from
String(32) to String(36) similar to other OpenStack services' UUID
column in the database. We will leverage in code
sqlalchemy_utils.types.uuid.UUIDType
for data represented
in flavor_id
.
Alembic Versions
Generate new Version file using Alembic. Make sure it has both upgrade() and downgrade() methods implemented.
objects/loadbalancer.py
Remove pool_id to be nullable=False in loadbalancer.py.
Add pools and parameters in fields section. These fields should default and an empty array.
Change the version to 1.1.
objects/base.py
Change domain_id to be nullable=True in KosmosOwnedObject.
objects
Add below py files:
- loadbalancer_pool.py
- loadbalancer_parameter.py
objects/__init__.py
Add loadbalancer_pool and loadbalancer_parameters to import statements
tests/unit/objects
Update test_kosmos_object_hashes.py with the new hashes.
Add test cases for all the objects.
Update the base test case.
Implementation
Assignee(s)
- Primary assignee:
-
krevuri
- Secondary assignees:
-
ma501v pr8721 praveen-komakula pradeepkumar.ks
Milestones
- Target Milestone for completion:
-
Pike