Add support for max_*_workers options

The [watcher_decision_engine] max_workers option was replaced by
separate options long time ago[1]. This adds support for the "new"
options so that users can set the appropriate limit.

Note that support for the removed max_workers option is kept now and
it will be deprecated separately, so that we can backport addition
of these new parameters.

[1] 2b6ee38327f70d749e71b81854c7b89cf9e69ac6

Change-Id: I128ccec0444ab7bd496001110a529cc24434af96
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-08-24 04:15:40 +09:00
parent a354c6bd5c
commit a45fa503aa
3 changed files with 28 additions and 0 deletions

View File

@@ -10,6 +10,16 @@
# (Optional) The state of the service
# Defaults to 'true'.
#
# [*max_audit_workers*]
# (Optional) The maximum number of threads that can be used to execute
# audits in pararell.
# Defaults to $facts['os_service_default']
#
# [*max_general_workers*]
# (Optional) The maximum number of threads that can be used to execute
# general tasks in parallel.
# Defaults to $facts['os_service_default']
#
# [*manage_service*]
# (Optional) Whether to start/stop the service.
# Defaults to 'true'.
@@ -55,6 +65,8 @@ class watcher::decision_engine (
$package_ensure = 'present',
Boolean $enabled = true,
Boolean $manage_service = true,
$max_audit_workers = $facts['os_service_default'],
$max_general_workers = $facts['os_service_default'],
$decision_engine_conductor_topic = $facts['os_service_default'],
$decision_engine_status_topic = $facts['os_service_default'],
$decision_engine_notification_topics = $facts['os_service_default'],
@@ -96,6 +108,8 @@ class watcher::decision_engine (
}
watcher_config {
'watcher_decision_engine/max_audit_workers': value => $max_audit_workers;
'watcher_decision_engine/max_general_workers': value => $max_general_workers;
'watcher_decision_engine/conductor_topic': value => $decision_engine_conductor_topic;
'watcher_decision_engine/status_topic': value => $decision_engine_status_topic;
'watcher_decision_engine/notification_topics': value => join(any2array($decision_engine_notification_topics), ',');

View File

@@ -0,0 +1,8 @@
---
features:
- |
The ``watcher::decision_engine`` class now supports the following two new
parameters.
- ``max_audit_workers``
- ``max_general_workers``

View File

@@ -15,6 +15,8 @@ describe 'watcher::decision_engine' do
end
it 'configures watcher decision engine service' do
is_expected.to contain_watcher_config('watcher_decision_engine/max_audit_workers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_watcher_config('watcher_decision_engine/max_general_workers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_watcher_config('watcher_decision_engine/conductor_topic').with_value('<SERVICE DEFAULT>')
is_expected.to contain_watcher_config('watcher_decision_engine/status_topic').with_value('<SERVICE DEFAULT>')
is_expected.to contain_watcher_config('watcher_decision_engine/notification_topics').with_value('<SERVICE DEFAULT>')
@@ -63,6 +65,8 @@ describe 'watcher::decision_engine' do
let :params do
{
:package_ensure => '2012.1.1-15.el6',
:max_audit_workers => 2,
:max_general_workers => 4,
:decision_engine_conductor_topic => 'test_conductor_topic',
:decision_engine_status_topic => 'niceTopic',
:decision_engine_notification_topics => ['topic_1','topic_2'],
@@ -76,6 +80,8 @@ describe 'watcher::decision_engine' do
}
end
it 'configures watcher decision engine' do
is_expected.to contain_watcher_config('watcher_decision_engine/max_audit_workers').with_value(2)
is_expected.to contain_watcher_config('watcher_decision_engine/max_general_workers').with_value(4)
is_expected.to contain_watcher_config('watcher_decision_engine/conductor_topic').with_value('test_conductor_topic')
is_expected.to contain_watcher_config('watcher_decision_engine/status_topic').with_value('niceTopic')
is_expected.to contain_watcher_config('watcher_decision_engine/notification_topics').with_value('topic_1,topic_2')