Support new virtual_interfaces definition for VIPs

Prior to this change, the keepalived element only allowed for a single
keepalive interface. This could be problematic if, for instance,
keepalive is managing several VIPs which are on different broadcast
domains - for instance, because one vip is on an interface/vlan that's
accessible to the public, while another is on an interface/vlan that's
only accessible within the cloud.

This change allows for a more flexible configuration in which multiple
vrrp instances can be defined in heat- each with their own interface,
router_id, and set of virtual IPs.

This patchset partially completes a spec which will one day live at
https://blueprints.launchpad.net/tripleo/+specs/tripleo-juno-virtual-public-ips
but for now can bee seen in  Id9addc65f0d2ed519ce4b3edbd561ed660a2786e

Removed the check weight configuration as vrrp_sync_groups and and
check_script weights are mutually exclusive configurations. Regardless,
based on
https://github.com/acassen/keepalived/blob/master/doc/keepalived.conf.SYNOPSIS#L103
the default weight is automatically set to 2 if not specified.

Change-Id: I5f04cee6c84ce7ad6e258c489088a47f00a53fda
Co-authored-by: Julia Kreger <juliaashleykreger@gmail.com>
This commit is contained in:
James Polley 2014-07-03 00:35:51 +02:00
parent e3d26159bd
commit f9510b001d
2 changed files with 57 additions and 1 deletions

View File

@ -3,6 +3,8 @@ Element to install keepalived
Configuration
-------------
Configuration can be provided two ways: the simpler, deprecated, way:
keepalived:
# interface used for VRRP traffic
keepalive_interface: eth0
@ -12,3 +14,27 @@ Configuration
interface: eth0
- ip: fe80::5cc1:afff:fe58:143b/64
interface: br-ctlplane
or the more detailed newer way for more complicated setups. If both ``virtual_interfaces`` and ``keepalived`` keys are present, the latter is ignored.
virtual_interfaces:
instances:
- vrrp_instance_name: VI_CONTROL
virtual_router_id: 51
keepalive_interface: eth0
priority: 101
virtual_ips:
- ip: 192.0.2.254/24
interface: eth0
- vrrp_instance_name: VI_PUBLIC
virtual_router_id: 52
keepalive_interface: eth0
priority: 101
virtual_ips:
- ip: 10.16.15.154/24
interface: vlan25
vrrp_sync_groups:
- name: VG1
members:
- VI_CONTROL
- VI_PUBLIC

View File

@ -1,9 +1,38 @@
vrrp_script chk_haproxy {
script "killall -0 haproxy"
interval 2
weight 2
}
{{#virtual_interfaces}}
{{#instances}}
vrrp_instance {{vrrp_instance_name}} {
interface {{keepalive_interface}}
state MASTER
virtual_router_id {{virtual_router_id}}
priority {{priority}}
virtual_ipaddress {
{{#virtual_ips}}
{{ip}} dev {{interface}}
{{/virtual_ips}}
}
track_script {
chk_haproxy
}
}
{{/instances}}
{{#vrrp_sync_groups}}
vrrp_sync_group {{name}}
group {
{{#members}}
{{.}}
{{/members}}
}
{{/vrrp_sync_groups}}
{{/virtual_interfaces}}
{{^virtual_interfaces}}
vrrp_instance VI_1 {
interface {{keepalived.keepalive_interface}}
state MASTER
@ -18,3 +47,4 @@ vrrp_instance VI_1 {
chk_haproxy
}
}
{{/virtual_interfaces}}