Rename haproxy_hosts to load_balancer_hosts

Due to the way of how dynamic_inventory parses groups, usage of
`haproxy_hosts` which are eventually mapped to `haproxy` lead bare
metal hosts to be also a part of `haproxy_all` group, which might be not
expected or anticipated.

Change-Id: Ib1199236a6dfecb47b5840f04cb4b1486cc2f6a6
This commit is contained in:
Dmitriy Rabotyagov 2024-07-17 18:45:27 +02:00
parent 0b46e32def
commit c5fbcbfbbb
15 changed files with 41 additions and 15 deletions

View File

@ -39,7 +39,7 @@ Ansible group mappings. These groups map to the physical
hosts.
The ``haproxy.yml.example`` file in the ``conf.d/`` directory provides
a simple example of defining a host group (``haproxy_hosts``) with two hosts
a simple example of defining a host group (``load_balancer_hosts``) with two hosts
(``infra1`` and ``infra2``).
The ``swift.yml.example`` file provides a more complex example. Here, host

View File

@ -1,4 +1,4 @@
---
haproxy_hosts:
load_balancer_hosts:
aio1:
ip: 172.29.236.100

View File

@ -1,5 +1,5 @@
# The nodes where haproxy will run
haproxy_hosts:
load_balancer_hosts:
infra1:
ip: 172.20.236.110
infra2:

View File

@ -132,6 +132,6 @@ repo-infra_hosts:
aio1:
ip: 172.29.236.100
haproxy_hosts:
load_balancer_hosts:
aio1:
ip: 172.29.236.100

View File

@ -805,7 +805,7 @@
#
# --------
#
# Level: haproxy_hosts (optional)
# Level: load_balancer_hosts (optional)
# List of target hosts on which to deploy HAProxy. Recommend at least one
# target host for this service if hardware load balancers are not being
# used.
@ -825,7 +825,7 @@
# While HAProxy can be used as a virtual load balancer, it is recommended to use
# a physical load balancer in a production environment.
#
# haproxy_hosts:
# load_balancer_hosts:
# lb1:
# ip: 172.29.236.100
# lb2:

View File

@ -111,7 +111,7 @@ repo-infra_hosts:
# load balancer
# Ideally the load balancer should not use the Infrastructure hosts.
# Dedicated hardware is best for improved performance and security.
haproxy_hosts:
load_balancer_hosts:
infra1:
ip: 172.29.236.11
infra2:

View File

@ -300,7 +300,7 @@ repo-infra_hosts: *controllers
# load balancer
# Ideally the load balancer should not use the Infrastructure hosts.
# Dedicated hardware is best for improved performance and security.
haproxy_hosts: *controllers
load_balancer_hosts: *controllers
###
### OpenStack

View File

@ -123,7 +123,7 @@ repo-infra_hosts: *infrastructure_hosts
# load balancer
# Ideally the load balancer should not use the Infrastructure hosts.
# Dedicated hardware is best for improved performance and security.
haproxy_hosts: *infrastructure_hosts
load_balancer_hosts: *infrastructure_hosts
###
### OpenStack

View File

@ -105,7 +105,7 @@ repo-infra_hosts:
# load balancer
# Ideally the load balancer should not use the Infrastructure hosts.
# Dedicated hardware is best for improved performance and security.
haproxy_hosts:
load_balancer_hosts:
infra1:
ip: 172.29.236.11
infra2:

View File

@ -149,7 +149,7 @@ repo-infra_hosts:
# load balancer
# Ideally the load balancer should not use the Infrastructure hosts.
# Dedicated hardware is best for improved performance and security.
haproxy_hosts:
load_balancer_hosts:
infra1:
ip: 172.29.236.11
infra2:

View File

@ -111,7 +111,7 @@ repo-infra_hosts:
# load balancer
# Ideally the load balancer should not use the Infrastructure hosts.
# Dedicated hardware is best for improved performance and security.
haproxy_hosts:
load_balancer_hosts:
infra1:
ip: 172.29.236.11
infra2:

View File

@ -82,7 +82,7 @@ repo-infra_hosts:
ip: 172.29.236.11
# load balancer
haproxy_hosts:
load_balancer_hosts:
infra1:
ip: 172.29.236.11

View File

@ -23,12 +23,19 @@ container_skel:
haproxy_container:
belongs_to:
- haproxy_containers
- load_balancer_containers
contains:
- haproxy
properties:
is_metal: true
physical_skel:
load_balancer_containers:
belongs_to:
- all_containers
load_balancer_hosts:
belongs_to:
- hosts
haproxy_containers:
belongs_to:
- all_containers

View File

@ -0,0 +1,16 @@
---
upgrade:
- |
Group name for HAProxy destination hosts in `openstack_user_config.yml``
was renamed from ``haproxy_hosts`` to ``load_balancer_hosts``.
While backwards compatability is kept, it is recommended to replace
defenition with the new group during the upgrade.
deprecations:
- |
Usage of ``haproxy_hosts`` in `openstack_user_config.yml`` has been
deprecated in favor of ``load_balancer_hosts``.
fixes:
- |
``haproxy_all`` group is no longer populated with bare metal hosts in
case of installing haproxy/keepalived inside LXC containers.

View File

@ -233,6 +233,9 @@ class TestAnsibleInventoryFormatConstraints(unittest.TestCase):
'haproxy_container',
'haproxy_containers',
'haproxy_hosts',
'load_balancer_containers',
'load_balancer_hosts',
'load_balancer_all',
'heat_all',
'heat_api',
'heat_api_cfn',
@ -789,7 +792,7 @@ class TestConfigChecks(TestConfigCheckBase):
self.assertEqual(context.exception.new_host, 'host2')
def test_two_hosts_same_ip_externally(self):
self.set_new_hostname(self.user_defined_config, "haproxy_hosts",
self.set_new_hostname(self.user_defined_config, "load_balancer_hosts",
"aio1", "hap")
with self.assertRaises(di.MultipleHostsWithOneIPError) as context:
get_inventory()
@ -801,7 +804,7 @@ class TestConfigChecks(TestConfigCheckBase):
def test_one_host_two_ips_externally(self):
# haproxy chosen because it was last in the config file as of
# writing
self.set_new_ip(self.user_defined_config, 'haproxy_hosts', 'aio1',
self.set_new_ip(self.user_defined_config, 'load_balancer_hosts', 'aio1',
'172.29.236.101')
with self.assertRaises(di.MultipleIpForHostError) as context:
get_inventory()