Configure VIPs for all networks including composable networks

Configure all VIPs including those on custom composable networks.
Hard-coded network names are removed and instead a hiera parameter
containing all networks is used.

For keepalived, the vrouter_id is generated from an index for each
network in the hiera data.  This will change the vrouter_ids for
some VIPs.

Change-Id: I117454afe750451ad1f2633fa0f196bb71740b8d
Partial-Bug: 1741129
Depends-On: If8d3219a0714e3db34980e884dce84912a837865
This commit is contained in:
Bob Fournier 2018-01-03 18:51:11 -05:00
parent cd8dd6c0d7
commit 5824044527
4 changed files with 71 additions and 114 deletions

View File

@ -40,17 +40,17 @@
# Defaults to undef
#
# [*internal_api_virtual_ip*]
# Virtual IP on the internal API network.
# DEPRECATED: Virtual IP on the internal API network.
# A string.
# Defaults to false
#
# [*storage_virtual_ip*]
# Virtual IP on the storage network.
# DEPRECATED: Virtual IP on the storage network.
# A string.
# Defaults to false
#
# [*storage_mgmt_virtual_ip*]
# Virtual IP on the storage mgmt network.
# DEPRECATED: Virtual IP on the storage mgmt network.
# A string.
# Defaults to false
#
@ -75,12 +75,13 @@ class tripleo::keepalived (
$control_virtual_interface,
$public_virtual_interface,
$public_virtual_ip,
$internal_api_virtual_ip = false,
$storage_virtual_ip = false,
$storage_mgmt_virtual_ip = false,
$redis_virtual_ip = false,
$ovndbs_virtual_ip = false,
$virtual_router_id_base = 50,
# DEPRECATED PARAMETERS
$internal_api_virtual_ip = false,
$storage_virtual_ip = false,
$storage_mgmt_virtual_ip = false,
) {
case $::osfamily {
@ -123,58 +124,6 @@ class tripleo::keepalived (
priority => 101,
}
if $internal_api_virtual_ip and $internal_api_virtual_ip != $controller_virtual_ip {
$internal_api_virtual_interface = interface_for_ip($internal_api_virtual_ip)
if is_ipv6_address($internal_api_virtual_ip) {
$internal_api_virtual_netmask = '64'
} else {
$internal_api_virtual_netmask = '32'
}
# KEEPALIVE INTERNAL API NETWORK
keepalived::instance { "${$virtual_router_id_base + 3}":
interface => $internal_api_virtual_interface,
virtual_ips => [join(["${internal_api_virtual_ip}/${internal_api_virtual_netmask}", ' dev ', $internal_api_virtual_interface])],
state => 'MASTER',
track_script => ['haproxy'],
priority => 101,
}
}
if $storage_virtual_ip and $storage_virtual_ip != $controller_virtual_ip {
$storage_virtual_interface = interface_for_ip($storage_virtual_ip)
if is_ipv6_address($storage_virtual_ip) {
$storage_virtual_netmask = '64'
} else {
$storage_virtual_netmask = '32'
}
# KEEPALIVE STORAGE NETWORK
keepalived::instance { "${$virtual_router_id_base + 4}":
interface => $storage_virtual_interface,
virtual_ips => [join(["${storage_virtual_ip}/${storage_virtual_netmask}", ' dev ', $storage_virtual_interface])],
state => 'MASTER',
track_script => ['haproxy'],
priority => 101,
}
}
if $storage_mgmt_virtual_ip and $storage_mgmt_virtual_ip != $controller_virtual_ip {
$storage_mgmt_virtual_interface = interface_for_ip($storage_mgmt_virtual_ip)
if is_ipv6_address($storage_mgmt_virtual_ip) {
$storage_mgmt_virtual_netmask = '64'
} else {
$storage_mgmt_virtual_netmask = '32'
}
# KEEPALIVE STORAGE MANAGEMENT NETWORK
keepalived::instance { "${$virtual_router_id_base + 5}":
interface => $storage_mgmt_virtual_interface,
virtual_ips => [join(["${storage_mgmt_virtual_ip}/${storage_mgmt_virtual_netmask}", ' dev ', $storage_mgmt_virtual_interface])],
state => 'MASTER',
track_script => ['haproxy'],
priority => 101,
}
}
if $redis_virtual_ip and $redis_virtual_ip != $controller_virtual_ip {
$redis_virtual_interface = interface_for_ip($redis_virtual_ip)
if is_ipv6_address($redis_virtual_ip) {
@ -182,8 +131,8 @@ class tripleo::keepalived (
} else {
$redis_virtual_netmask = '32'
}
# KEEPALIVE STORAGE MANAGEMENT NETWORK
keepalived::instance { "${$virtual_router_id_base + 6}":
# KEEPALIVE REDIS INSTANCE
keepalived::instance { "${$virtual_router_id_base + 3}":
interface => $redis_virtual_interface,
virtual_ips => [join(["${redis_virtual_ip}/${redis_virtual_netmask}", ' dev ', $redis_virtual_interface])],
state => 'MASTER',
@ -195,7 +144,7 @@ class tripleo::keepalived (
if $ovndbs_virtual_ip and $ovndbs_virtual_ip != $controller_virtual_ip {
$ovndbs_virtual_interface = interface_for_ip($ovndbs_virtual_ip)
# KEEPALIVE OVNDBS MANAGEMENT NETWORK
keepalived::instance { "${$virtual_router_id_base + 7}":
keepalived::instance { "${$virtual_router_id_base + 4}":
interface => $ovndbs_virtual_interface,
virtual_ips => [join([$ovndbs_virtual_ip, ' dev ', $ovndbs_virtual_interface])],
state => 'MASTER',
@ -203,4 +152,31 @@ class tripleo::keepalived (
priority => 101,
}
}
# NOTE - add any new VIPs before the isolated network vips and update this
# to use the new vrouter id
$last_fixed_vrouter_id = $virtual_router_id_base + 4
# Set up all vips for isolated networks, the vrouter id is based on a sequential index
$network_vips = hiera('network_virtual_ips', {})
$network_vips.each |String $net_name, $vip_info| {
$virtual_ip = $vip_info[ip_address]
if $virtual_ip and $virtual_ip != $controller_virtual_ip {
$virtual_interface = interface_for_ip($virtual_ip)
if is_ipv6_address($virtual_ip) {
$virtual_netmask = '64'
} else {
$virtual_netmask = '32'
}
$vrouter_id = $last_fixed_vrouter_id + $vip_info["index"]
keepalived::instance { "${vrouter_id}":
interface => $virtual_interface,
virtual_ips => [join(["${virtual_ip}/${virtual_netmask}", ' dev ', $virtual_interface])],
state => 'MASTER',
track_script => ['haproxy'],
priority => 101,
}
}
}
}

View File

@ -117,34 +117,18 @@ class tripleo::profile::pacemaker::haproxy (
require => Pacemaker::Property['haproxy-role-node-property'],
}
$internal_api_vip = hiera('internal_api_virtual_ip')
tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_internal_api_vip':
ensure => $internal_api_vip and $internal_api_vip != $control_vip,
vip_name => 'internal_api',
ip_address => $internal_api_vip,
location_rule => $haproxy_location_rule,
pcs_tries => $pcs_tries,
require => Pacemaker::Property['haproxy-role-node-property'],
}
$storage_vip = hiera('storage_virtual_ip')
tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_vip':
ensure => $storage_vip and $storage_vip != $control_vip,
vip_name => 'storage',
ip_address => $storage_vip,
location_rule => $haproxy_location_rule,
pcs_tries => $pcs_tries,
require => Pacemaker::Property['haproxy-role-node-property'],
}
$storage_mgmt_vip = hiera('storage_mgmt_virtual_ip')
tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_mgmt_vip':
ensure => $storage_mgmt_vip and $storage_mgmt_vip != $control_vip,
vip_name => 'storage_mgmt',
ip_address => $storage_mgmt_vip,
location_rule => $haproxy_location_rule,
pcs_tries => $pcs_tries,
require => Pacemaker::Property['haproxy-role-node-property'],
# Set up all vips for isolated networks
$network_vips = hiera('network_virtual_ips', {})
$network_vips.each |String $net_name, $vip_info| {
$virtual_ip = $vip_info[ip_address]
tripleo::pacemaker::haproxy_with_vip {"haproxy_and_${net_name}_vip":
ensure => $virtual_ip and $virtual_ip != $control_vip,
vip_name => $net_name,
ip_address => $virtual_ip,
location_rule => $haproxy_location_rule,
pcs_tries => $pcs_tries,
require => Pacemaker::Property['haproxy-role-node-property'],
}
}
}
}

View File

@ -255,31 +255,17 @@ class tripleo::profile::pacemaker::haproxy_bundle (
pcs_tries => $pcs_tries,
}
$internal_api_vip = hiera('internal_api_virtual_ip')
tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_internal_api_vip':
ensure => $internal_api_vip and $internal_api_vip != $control_vip,
vip_name => 'internal_api',
ip_address => $internal_api_vip,
location_rule => $haproxy_location_rule,
pcs_tries => $pcs_tries,
}
$storage_vip = hiera('storage_virtual_ip')
tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_vip':
ensure => $storage_vip and $storage_vip != $control_vip,
vip_name => 'storage',
ip_address => $storage_vip,
location_rule => $haproxy_location_rule,
pcs_tries => $pcs_tries,
}
$storage_mgmt_vip = hiera('storage_mgmt_virtual_ip')
tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_mgmt_vip':
ensure => $storage_mgmt_vip and $storage_mgmt_vip != $control_vip,
vip_name => 'storage_mgmt',
ip_address => $storage_mgmt_vip,
location_rule => $haproxy_location_rule,
pcs_tries => $pcs_tries,
# Set up all vips for isolated networks
$network_vips = hiera('network_virtual_ips', {})
$network_vips.each |String $net_name, $vip_info| {
$virtual_ip = $vip_info[ip_address]
tripleo::pacemaker::haproxy_with_vip {"haproxy_and_${net_name}_vip":
ensure => $virtual_ip and $virtual_ip != $control_vip,
vip_name => $net_name,
ip_address => $virtual_ip,
location_rule => $haproxy_location_rule,
pcs_tries => $pcs_tries,
}
}
}
}

View File

@ -0,0 +1,11 @@
---
deprecations:
- The hardcoded parameter names for network vips in hiera have been
deprecated and replaced with the network_virtual_ips dict that includes
composable networks. Likewise the hardcoded network parameters to
class tripleo::keepalived have been deprecated.
fixes:
- The new network_virtual_ips hiera parameter is used to generate all
network VIP resources in haproxy, haproxy_bundle, and keepalived
manifests. Since additional custom networks may be added, the
virtual_router_ids in keepalived have been reordered.