listener: Add support for tunable parameters
Change-Id: Iaa9199dde153cfd218171a0b23c724bad421529c
This commit is contained in:
parent
e4916c32c8
commit
9400853421
@ -1,34 +1,53 @@
|
|||||||
# Installs the aodh listener service
|
# Installs the aodh listener service
|
||||||
#
|
#
|
||||||
# == Params
|
# == Params
|
||||||
# [*enabled*]
|
# [*enabled*]
|
||||||
# (optional) Should the service be enabled.
|
# (optional) Should the service be enabled.
|
||||||
# Defaults to true.
|
# Defaults to true.
|
||||||
#
|
#
|
||||||
# [*manage_service*]
|
# [*manage_service*]
|
||||||
# (optional) Whether the service should be managed by Puppet.
|
# (optional) Whether the service should be managed by Puppet.
|
||||||
# Defaults to true.
|
# Defaults to true.
|
||||||
#
|
#
|
||||||
# [*package_ensure*]
|
# [*package_ensure*]
|
||||||
# (optional) ensure state for package.
|
# (optional) ensure state for package.
|
||||||
# Defaults to 'present'
|
# Defaults to 'present'
|
||||||
#
|
#
|
||||||
# [*workers*]
|
# [*workers*]
|
||||||
# (optional) Number of workers for evaluator service.
|
# (optional) Number of workers for evaluator service.
|
||||||
# Defaults to $::os_workers.
|
# Defaults to $::os_workers.
|
||||||
|
#
|
||||||
|
# [*event_alarm_topic*]
|
||||||
|
# (optional) The topic that aodh uses for event alarm evaluation.
|
||||||
|
# Defualts to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*batch_size*]
|
||||||
|
# (optional) Number of notification messages to wait before dispatching them.
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*batch_timeout*]
|
||||||
|
# (optional) Number of seconds to wait before dispatching samples when
|
||||||
|
# batch_size is not reached.
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
#
|
#
|
||||||
class aodh::listener (
|
class aodh::listener (
|
||||||
$manage_service = true,
|
$manage_service = true,
|
||||||
$enabled = true,
|
$enabled = true,
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$workers = $::os_workers,
|
$workers = $::os_workers,
|
||||||
|
$event_alarm_topic = $::os_service_default,
|
||||||
|
$batch_size = $::os_service_default,
|
||||||
|
$batch_timeout = $::os_service_default,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include aodh::deps
|
include aodh::deps
|
||||||
include aodh::params
|
include aodh::params
|
||||||
|
|
||||||
aodh_config {
|
aodh_config {
|
||||||
'listener/workers': value => $workers
|
'listener/workers': value => $workers;
|
||||||
|
'listener/event_alarm_topic': value => $event_alarm_topic;
|
||||||
|
'listener/batch_size': value => $batch_size;
|
||||||
|
'listener/batch_timeout': value => $batch_timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
package { 'aodh-listener':
|
package { 'aodh-listener':
|
||||||
|
9
releasenotes/notes/listener-opts-517861fd3efdb40c.yaml
Normal file
9
releasenotes/notes/listener-opts-517861fd3efdb40c.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The ``aodh::listener`` class now supports the following three new
|
||||||
|
parameters.
|
||||||
|
|
||||||
|
- ``event_alarm_topic``
|
||||||
|
- ``batch_size``
|
||||||
|
- ``batch_timeout``
|
@ -8,17 +8,7 @@ describe 'aodh::listener' do
|
|||||||
|
|
||||||
shared_examples_for 'aodh-listener' do
|
shared_examples_for 'aodh-listener' do
|
||||||
|
|
||||||
context 'with workers' do
|
context 'with defaults' do
|
||||||
let :params do
|
|
||||||
{ :workers => 8 }
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'configures workers' do
|
|
||||||
is_expected.to contain_aodh_config('listener/workers').with_value(8)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when enabled' do
|
|
||||||
it { is_expected.to contain_class('aodh::params') }
|
it { is_expected.to contain_class('aodh::params') }
|
||||||
|
|
||||||
it 'installs aodh-listener package' do
|
it 'installs aodh-listener package' do
|
||||||
@ -42,6 +32,9 @@ describe 'aodh::listener' do
|
|||||||
|
|
||||||
it 'sets default values' do
|
it 'sets default values' do
|
||||||
is_expected.to contain_aodh_config('listener/workers').with_value(4)
|
is_expected.to contain_aodh_config('listener/workers').with_value(4)
|
||||||
|
is_expected.to contain_aodh_config('listener/event_alarm_topic').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_aodh_config('listener/batch_size').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_aodh_config('listener/batch_timeout').with_value('<SERVICE DEFAULT>')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -74,6 +67,24 @@ describe 'aodh::listener' do
|
|||||||
is_expected.to_not contain_service('aodh-listener')
|
is_expected.to_not contain_service('aodh-listener')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with parameters' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:workers => 8,
|
||||||
|
:event_alarm_topic => 'alarm.all',
|
||||||
|
:batch_size => 1,
|
||||||
|
:batch_timeout => 60,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configures the given values' do
|
||||||
|
is_expected.to contain_aodh_config('listener/workers').with_value(8)
|
||||||
|
is_expected.to contain_aodh_config('listener/event_alarm_topic').with_value('alarm.all')
|
||||||
|
is_expected.to contain_aodh_config('listener/batch_size').with_value(1)
|
||||||
|
is_expected.to contain_aodh_config('listener/batch_timeout').with_value(60)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user