Deploy Loadbalancer as a composable role

Deploy loadbalancer service using puppet-tripleo, and drop puppet code.

Implements: blueprint refactor-puppet-manifests
Depends-On: I9b106dcc1a4d446ab5dea8430ed295e6ec209cbd

Change-Id: I9ca50a4bc822ec17d89988894af9bdf07e4bd1a9
This commit is contained in:
Emilien Macchi 2016-05-05 11:46:51 -04:00
parent 3ddb1136e5
commit 40ad289910
7 changed files with 63 additions and 78 deletions

View File

@ -16,3 +16,4 @@ resource_registry:
OS::TripleO::Services::NeutronL3Agent: ../puppet/services/pacemaker/neutron-l3.yaml
OS::TripleO::Services::NeutronMetadataAgent: ../puppet/services/pacemaker/neutron-metadata.yaml
OS::TripleO::Services::RabbitMQ: ../puppet/services/pacemaker/rabbitmq.yaml
OS::TripleO::Services::Loadbalancer: ../puppet/services/pacemaker/loadbalancer.yaml

View File

@ -130,6 +130,7 @@ resource_registry:
OS::TripleO::Services::NeutronL3Agent: puppet/services/neutron-l3.yaml
OS::TripleO::Services::NeutronMetadataAgent: puppet/services/neutron-metadata.yaml
OS::TripleO::Services::RabbitMQ: puppet/services/rabbitmq.yaml
OS::TripleO::Services::Loadbalancer: puppet/services/loadbalancer.yaml
parameter_defaults:
EnablePackageInstall: false

View File

@ -658,6 +658,7 @@ parameters:
- OS::TripleO::Services::NeutronL3Agent
- OS::TripleO::Services::NeutronMetadataAgent
- OS::TripleO::Services::RabbitMQ
- OS::TripleO::Services::Loadbalancer
description: A list of service resources (configured in the Heat
resource_registry) which represent nested stacks
for each service that should get installed on the Controllers.

View File

@ -24,15 +24,6 @@ if hiera('step') >= 1 {
create_resources(sysctl::value, hiera('sysctl_settings'), {})
Exec <| tag == 'kmod::load' |> -> Sysctl <| |>
$controller_node_ips = split(hiera('controller_node_ips'), ',')
if $enable_load_balancer {
class { '::tripleo::loadbalancer' :
controller_hosts => $controller_node_ips,
manage_vip => true,
}
}
}
if hiera('step') >= 2 {

View File

@ -66,18 +66,6 @@ if hiera('step') >= 1 {
include ::ntp
}
$controller_node_ips = split(hiera('controller_node_ips'), ',')
$controller_node_names = split(downcase(hiera('controller_node_names')), ',')
if $enable_load_balancer {
class { '::tripleo::loadbalancer' :
controller_hosts => $controller_node_ips,
controller_hosts_names => $controller_node_names,
manage_vip => false,
mysql_clustercheck => true,
haproxy_service_manage => false,
}
}
$pacemaker_cluster_members = downcase(regsubst(hiera('controller_node_names'), ',', ' ', 'G'))
$corosync_ipv6 = str2bool(hiera('corosync_ipv6', false))
if $corosync_ipv6 {
@ -210,64 +198,12 @@ if hiera('step') >= 2 {
if $pacemaker_master {
if $enable_load_balancer {
include ::pacemaker::resource_defaults
include ::pacemaker::resource_defaults
# Create an openstack-core dummy resource. See RHBZ 1290121
pacemaker::resource::ocf { 'openstack-core':
ocf_agent_name => 'heartbeat:Dummy',
clone_params => true,
}
# FIXME: we should not have to access tripleo::loadbalancer class
# parameters here to configure pacemaker VIPs. The configuration
# of pacemaker VIPs could move into puppet-tripleo or we should
# make use of less specific hiera parameters here for the settings.
pacemaker::resource::service { 'haproxy':
clone_params => true,
}
$control_vip = hiera('tripleo::loadbalancer::controller_virtual_ip')
tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_control_vip':
vip_name => 'control',
ip_address => $control_vip,
}
$public_vip = hiera('tripleo::loadbalancer::public_virtual_ip')
tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_public_vip':
ensure => $public_vip and $public_vip != $control_vip,
vip_name => 'public',
ip_address => $public_vip,
}
$redis_vip = hiera('redis_vip')
tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_redis_vip':
ensure => $redis_vip and $redis_vip != $control_vip,
vip_name => 'redis',
ip_address => $redis_vip,
}
$internal_api_vip = hiera('tripleo::loadbalancer::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,
}
$storage_vip = hiera('tripleo::loadbalancer::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,
}
$storage_mgmt_vip = hiera('tripleo::loadbalancer::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,
}
# Create an openstack-core dummy resource. See RHBZ 1290121
pacemaker::resource::ocf { 'openstack-core':
ocf_agent_name => 'heartbeat:Dummy',
clone_params => true,
}
pacemaker::resource::service { $::memcached::params::service_name :

View File

@ -0,0 +1,21 @@
heat_template_version: 2016-04-08
description: >
Loadbalancer service configured with Puppet
parameters:
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
MysqlVirtualIPUri:
type: string
default: ''
outputs:
role_data:
description: Role data for the Loadbalancer role.
value:
step_config: |
include ::tripleo::profile::base::loadbalancer

View File

@ -0,0 +1,34 @@
heat_template_version: 2016-04-08
description: >
Loadbalancer service with Pacemaker configured with Puppet
parameters:
EndpointMap:
default: {}
description: Mapping of service endpoint -> protocol. Typically set
via parameter_defaults in the resource registry.
type: json
MysqlVirtualIPUri:
type: string
default: ''
resources:
LoadbalancerServiceBase:
type: ../loadbalancer.yaml
properties:
EndpointMap: {get_param: EndpointMap}
MysqlVirtualIPUri: {get_param: MysqlVirtualIPUri}
outputs:
role_data:
description: Role data for the Loadbalancer pacemaker role.
value:
config_settings:
map_merge:
- get_attr: [LoadbalancerServiceBase, role_data, config_settings]
- tripleo::loadbalancer::haproxy_service_manage: false
tripleo::loadbalancer::mysql_clustercheck: true
tripleo::loadbalancer::manage_vip: false
step_config: |
include ::tripleo::profile::pacemaker::loadbalancer