loadbalancer: Add option to not define track script

We've seen issues in CI when keepalived haproxy check script returns
an error and keepalived is switching to backup and then again to primary
on a single node environment.

Closes-Bug: #2025219

Change-Id: Iba62e76b3cf83f3ade6df81288d2d77129ffc725
This commit is contained in:
Michal Nasiadka 2023-06-27 09:42:31 +02:00
parent 1e9f19aa6b
commit a0e614ee10
5 changed files with 22 additions and 0 deletions

View File

@ -146,3 +146,7 @@ haproxy_host_ipv4_tcp_retries2: "KOLLA_UNSET"
haproxy_socket_level_admin: "no"
kolla_externally_managed_cert: False
# Allow to disable keepalived tracking script (e.g. for single node environments
# where this proves problematic in some cases)
keepalived_track_script_enabled: True

View File

@ -98,6 +98,7 @@
become: true
with_dict: "{{ loadbalancer_services }}"
when:
- keepalived_track_script_enabled | bool
- inventory_hostname in groups[service.group]
- inventory_hostname in groups[item.value.group]
- item.key != 'keepalived'

View File

@ -1,9 +1,11 @@
{% if keepalived_track_script_enabled | bool %}
vrrp_script check_alive {
script "/check_alive.sh"
interval 2
fall 2
rise 10
}
{% endif %}
vrrp_instance kolla_internal_vip_{{ keepalived_virtual_router_id }} {
state BACKUP
@ -40,7 +42,9 @@ vrrp_instance kolla_internal_vip_{{ keepalived_virtual_router_id }} {
auth_type PASS
auth_pass {{ keepalived_password }}
}
{% if keepalived_track_script_enabled | bool %}
track_script {
check_alive
}
{% endif %}
}

View File

@ -0,0 +1,9 @@
---
fixes:
- |
Fixes an issue where keepalived track script fails on single controller
environment and keepalived VIP goes into BACKUP state.
``keepalived_track_script_enabled`` variable has been introduced (default:
true), which can be used to disable track scripts in keepalived
configuration.
`LP#2025219 <https://launchpad.net/bugs/2025219>`__

View File

@ -202,3 +202,7 @@ enable_opensearch: "yes"
enable_keystone: "yes"
enable_venus: "yes"
{% endif %}
{% if groups['all'] | length == 1 %}
keepalived_track_script_enabled: "no"
{% endif %}