Add support for [healthcheck] allowed_source_ranges

Change-Id: Iddb38da980cf01536185c6c910ca68ac35c8a436
This commit is contained in:
Takashi Kajinami 2024-01-14 21:57:14 +09:00
parent 1d34a8d183
commit 97ee84e76f
3 changed files with 17 additions and 0 deletions

View File

@ -13,6 +13,11 @@
# that information back as part of a request.
# Defaults to $facts['os_service_default']
#
# [*allowed_source_ranges*]
# (Optional) A list of network addresses to limit source ip allowed to access
# healthcheck information.
# Defaults to $facts['os_service_default']
#
# [*disable_by_file_path*]
# (Optional) Check the presence of a file to determine if an application
# is running on a port.
@ -26,16 +31,19 @@
define oslo::healthcheck(
$detailed = $facts['os_service_default'],
$backends = $facts['os_service_default'],
$allowed_source_ranges = $facts['os_service_default'],
$disable_by_file_path = $facts['os_service_default'],
$disable_by_file_paths = $facts['os_service_default'],
) {
$backends_real = join(any2array($backends), ',')
$allowed_source_ranges_real = join(any2array($allowed_source_ranges), ',')
$disable_by_file_paths_real = join(any2array($disable_by_file_paths), ',')
$healthcheck_options = {
'healthcheck/detailed' => { value => $detailed },
'healthcheck/backends' => { value => $backends_real },
'healthcheck/allowed_source_ranges' => { value => $allowed_source_ranges_real },
'healthcheck/disable_by_file_path' => { value => $disable_by_file_path },
'healthcheck/disable_by_file_paths' => { value => $disable_by_file_paths_real},
}

View File

@ -0,0 +1,4 @@
---
features:
- |
The ``oslo::healthcheck::allowed_source_ranges`` parameter has been added.

View File

@ -14,6 +14,7 @@ describe 'oslo::healthcheck' do
it 'configure healthcheck default params' do
is_expected.to contain_keystone_config('healthcheck/detailed').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('healthcheck/backends').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('healthcheck/allowed_source_ranges').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('healthcheck/disable_by_file_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('healthcheck/disable_by_file_paths').with_value('<SERVICE DEFAULT>')
end
@ -24,6 +25,7 @@ describe 'oslo::healthcheck' do
{
:detailed => true,
:backends => ['disable_by_file', 'disable_by_files_ports'],
:allowed_source_ranges => ['10.0.0.0/24', '10.0.1.0/24'],
:disable_by_file_path => '/etc/keystone/healthcheck/disabled',
:disable_by_file_paths => [
'5000:/etc/keystone/healthcheck/public-disabled',
@ -37,6 +39,9 @@ describe 'oslo::healthcheck' do
is_expected.to contain_keystone_config('healthcheck/backends').with_value(
'disable_by_file,disable_by_files_ports'
)
is_expected.to contain_keystone_config('healthcheck/allowed_source_ranges').with_value(
'10.0.0.0/24,10.0.1.0/24'
)
is_expected.to contain_keystone_config('healthcheck/disable_by_file_path').with_value(
'/etc/keystone/healthcheck/disabled'
)