Fixed VRRP nopreempt option

The nopreempt option from keepalived didn't work as expected because the
role of the MASTER amphora was set in the configuration file [0].
Removing the default roles fixes this issue.
Now the newly created amphora after a failover doesn't preempt the
MASTER role from the other amphora.

[0] https://github.com/acassen/keepalived/blob/master/doc/man/man5/\
        keepalived.conf.5.in#L2011-L2017

Story 2010595
Task 47457

Change-Id: Icac1764e818b9a600bc939cc5883c64f5adaed36
This commit is contained in:
Gregory Thiemonge 2023-02-27 05:26:17 -05:00
parent b4b6e07fe0
commit 911faf2623
4 changed files with 8 additions and 6 deletions

View File

@ -132,7 +132,6 @@ class KeepalivedJinjaTemplater(object):
peers_ips.append(amp.vrrp_ip)
return self.get_template(self.keepalived_template).render(
{'vrrp_group_name': loadbalancer.vrrp_group.vrrp_group_name,
'amp_role': amphora.role,
'amp_intf': amphora.vrrp_interface,
'amp_vrrp_id': amphora.vrrp_id,
'amp_priority': amphora.vrrp_priority,

View File

@ -21,7 +21,6 @@ vrrp_script check_script {
}
vrrp_instance {{ vrrp_group_name }} {
state {{ amp_role }}
interface {{ amp_intf }}
virtual_router_id {{ amp_vrrp_id }}
priority {{ amp_priority }}

View File

@ -71,7 +71,6 @@ class TestVRRPRestDriver(base.TestCase):
"}\n"
"\n"
"vrrp_instance TESTGROUP {\n"
" state MASTER\n"
" interface eth1\n"
" virtual_router_id 1\n"
" priority 100\n"
@ -124,7 +123,6 @@ class TestVRRPRestDriver(base.TestCase):
"}\n"
"\n"
"vrrp_instance TESTGROUP {\n"
" state MASTER\n"
" interface eth1\n"
" virtual_router_id 1\n"
" priority 100\n"
@ -170,7 +168,6 @@ class TestVRRPRestDriver(base.TestCase):
"}\n"
"\n"
"vrrp_instance TESTGROUP {\n"
" state MASTER\n"
" interface eth1\n"
" virtual_router_id 1\n"
" priority 100\n"
@ -220,7 +217,6 @@ class TestVRRPRestDriver(base.TestCase):
"}\n"
"\n"
"vrrp_instance TESTGROUP {\n"
" state MASTER\n"
" interface eth1\n"
" virtual_router_id 1\n"
" priority 100\n"

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Fixed a bug with the `nopreempt` option in keepalived. The option didn't
work properly because the default role of the `MASTER` amphora was set.
Removing the default roles from the configuration files fixed that issue.
Now after a failover, the newly created amphora doesn't preempt the
`MASTER` role from the other amphora.