Merge "Switch to haproxy::listen for stats"
This commit is contained in:
commit
f0eb088ae2
|
@ -66,7 +66,7 @@ class haproxy::params {
|
|||
default: { fail("The ${::osfamily} operating system is not supported with the haproxy module") }
|
||||
}
|
||||
$use_include = false
|
||||
$use_stats = true
|
||||
$use_stats = false
|
||||
$stats_port = '10000'
|
||||
$stats_ipaddresses = ['127.0.0.1']
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# vip
|
||||
#
|
||||
# [*ipaddresses*]
|
||||
# (required) Array. This is an array of ipaddresses for the backend services
|
||||
# (optional) Array. This is an array of ipaddresses for the backend services
|
||||
# to be loadbalanced
|
||||
#
|
||||
# [*order*]
|
||||
|
@ -21,7 +21,7 @@
|
|||
# vip
|
||||
#
|
||||
# [*server_names*]
|
||||
# (required) Array. This is an array of server names for the haproxy service
|
||||
# (optional) Array. This is an array of server names for the haproxy service
|
||||
#
|
||||
# [*balancemember_options*]
|
||||
# (optional) String or Array. Options for the balancermember configuration.
|
||||
|
@ -70,11 +70,9 @@
|
|||
# Defaults to false.
|
||||
define openstack::ha::haproxy_service (
|
||||
$internal_virtual_ip,
|
||||
$ipaddresses,
|
||||
$listen_port,
|
||||
$order,
|
||||
$public_virtual_ip,
|
||||
$server_names,
|
||||
$balancermember_options = 'check',
|
||||
$balancermember_port = $listen_port,
|
||||
$before_start = false,
|
||||
|
@ -83,9 +81,11 @@ define openstack::ha::haproxy_service (
|
|||
$haproxy_config_options = { 'option' => ['httplog'],
|
||||
'balance' => 'roundrobin' },
|
||||
$internal = true,
|
||||
$mode = undef,
|
||||
$public = false,
|
||||
$public_ssl = false,
|
||||
$ipaddresses = undef,
|
||||
$server_names = undef,
|
||||
$mode = undef,
|
||||
$require_service = undef,
|
||||
) {
|
||||
|
||||
|
@ -133,28 +133,30 @@ define openstack::ha::haproxy_service (
|
|||
}
|
||||
}
|
||||
|
||||
# Add balancer memeber to HAProxy
|
||||
haproxy::balancermember { $name:
|
||||
order => $order,
|
||||
listening_service => $name,
|
||||
server_names => $server_names,
|
||||
ipaddresses => $ipaddresses,
|
||||
ports => $balancermember_port,
|
||||
options => $balancermember_options,
|
||||
define_cookies => $define_cookies,
|
||||
define_backups => $define_backups,
|
||||
use_include => true,
|
||||
if $ipaddresses and $server_names {
|
||||
haproxy::balancermember { $name:
|
||||
order => $order,
|
||||
listening_service => $name,
|
||||
server_names => $server_names,
|
||||
ipaddresses => $ipaddresses,
|
||||
ports => $balancermember_port,
|
||||
options => $balancermember_options,
|
||||
define_cookies => $define_cookies,
|
||||
define_backups => $define_backups,
|
||||
use_include => true,
|
||||
before => Exec["haproxy restart for ${name}"],
|
||||
}
|
||||
}
|
||||
|
||||
# Dirty hack, due Puppet can't send notify between stages
|
||||
exec { "haproxy restart for ${name}":
|
||||
command => 'export OCF_ROOT="/usr/lib/ocf"; (ip netns list | grep haproxy) && ip netns exec haproxy /usr/lib/ocf/resource.d/fuel/ns_haproxy restart',
|
||||
path => '/usr/bin:/usr/sbin:/bin:/sbin',
|
||||
logoutput => true,
|
||||
provider => 'shell',
|
||||
tries => 10,
|
||||
try_sleep => 10,
|
||||
returns => [0, ''],
|
||||
require => [Haproxy::Listen[$name], Haproxy::Balancermember[$name]],
|
||||
command => 'export OCF_ROOT="/usr/lib/ocf"; (ip netns list | grep haproxy) && ip netns exec haproxy /usr/lib/ocf/resource.d/fuel/ns_haproxy restart',
|
||||
path => '/usr/bin:/usr/sbin:/bin:/sbin',
|
||||
logoutput => true,
|
||||
provider => 'shell',
|
||||
tries => 10,
|
||||
try_sleep => 10,
|
||||
returns => [0, ''],
|
||||
require => Haproxy::Listen[$name],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
# == Class: openstack::ha::stats
|
||||
#
|
||||
# Configuration for Haproxy Stats
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*internal_virtual_ip*]
|
||||
# (required) String. This is the ipaddress to be used for the internal facing
|
||||
# vip
|
||||
#
|
||||
# [*public_virtual_ip*]
|
||||
# (required) String. This is the ipaddress to be used for the external facing
|
||||
# vip
|
||||
#
|
||||
class openstack::ha::stats ( $internal_virtual_ip,
|
||||
$public_virtual_ip ) {
|
||||
openstack::ha::haproxy_service { 'stats':
|
||||
public_virtual_ip => $public_virtual_ip,
|
||||
internal_virtual_ip => $internal_virtual_ip,
|
||||
order => '010',
|
||||
listen_port => '10000',
|
||||
haproxy_config_options => {
|
||||
'stats' => ['enable', 'uri /', 'refresh 5s', 'show-node', 'show-legends', 'hide-version'],
|
||||
'mode' => 'http',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
notice('MODULAR: openstack-haproxy-stats.pp')
|
||||
|
||||
$public_virtual_ip = pick(hiera('public_service_endpoint', undef), hiera('public_vip'))
|
||||
$internal_virtual_ip = pick(hiera('service_endpoint', undef), hiera('management_vip'))
|
||||
|
||||
class { '::openstack::ha::stats':
|
||||
internal_virtual_ip => $internal_virtual_ip,
|
||||
public_virtual_ip => $public_virtual_ip,
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
require File.join File.dirname(__FILE__), 'haproxy_post_common.rb'
|
||||
|
||||
def expected_backends
|
||||
return $expected_backends if $expected_backends
|
||||
backends = %w(
|
||||
stats
|
||||
)
|
||||
$expected_backends = backends
|
||||
end
|
||||
|
||||
OpenstackHaproxyPostTest.create_tests
|
||||
|
|
@ -191,3 +191,16 @@
|
|||
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy_pre.rb
|
||||
test_post:
|
||||
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-murano_post.rb
|
||||
|
||||
- id: openstack-haproxy-stats
|
||||
type: puppet
|
||||
groups: [primary-controller, controller]
|
||||
required_for: [deploy_end]
|
||||
requires: [deploy_start, cluster-haproxy]
|
||||
parameters:
|
||||
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-stats.pp
|
||||
puppet_modules: /etc/puppet/modules
|
||||
timeout: 300
|
||||
test_post:
|
||||
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-stats_post.rb
|
||||
|
||||
|
|
|
@ -25,6 +25,5 @@ describe manifest do
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
test_ubuntu_and_centos manifest
|
||||
end
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
require 'spec_helper'
|
||||
require 'shared-examples'
|
||||
manifest = 'openstack-haproxy/openstack-haproxy-stats.pp'
|
||||
|
||||
describe manifest do
|
||||
shared_examples 'catalog' do
|
||||
management_vip = Noop.hiera 'management_vip'
|
||||
|
||||
it "should contain stats fragment and listen only #{management_vip}" do
|
||||
should contain_concat__fragment('stats_listen_block').with_content(
|
||||
%r{\n\s*bind\s+#{management_vip}:10000\s*$\n}
|
||||
)
|
||||
end
|
||||
end
|
||||
test_ubuntu_and_centos manifest
|
||||
end
|
Loading…
Reference in New Issue