inspector: Fix missing healthcheck options

... to sync the healthceck class for ironic-inspector with the one for
ironic.

Change-Id: I8a560d2a91f518e94dbfcce0eb8338b1348e3b16
This commit is contained in:
Takashi Kajinami
2024-07-23 19:31:17 +09:00
parent f63900b549
commit bbcbe13ecf
3 changed files with 49 additions and 22 deletions

View File

@@ -17,6 +17,15 @@
# 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']
#
# [*ignore_proxied_requests*]
# (Optional) Ignore requests with proxy headers
# 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.
@@ -28,11 +37,13 @@
# Defaults to $facts['os_service_default']
#
class ironic::inspector::healthcheck (
$enabled = $facts['os_service_default'],
$detailed = $facts['os_service_default'],
$backends = $facts['os_service_default'],
$disable_by_file_path = $facts['os_service_default'],
$disable_by_file_paths = $facts['os_service_default'],
$enabled = $facts['os_service_default'],
$detailed = $facts['os_service_default'],
$backends = $facts['os_service_default'],
$allowed_source_ranges = $facts['os_service_default'],
$ignore_proxied_requests = $facts['os_service_default'],
$disable_by_file_path = $facts['os_service_default'],
$disable_by_file_paths = $facts['os_service_default'],
) {
include ironic::deps
@@ -42,9 +53,11 @@ class ironic::inspector::healthcheck (
}
oslo::healthcheck { 'ironic_inspector_config':
detailed => $detailed,
backends => $backends,
disable_by_file_path => $disable_by_file_path,
disable_by_file_paths => $disable_by_file_paths,
detailed => $detailed,
backends => $backends,
allowed_source_ranges => $allowed_source_ranges,
ignore_proxied_requests => $ignore_proxied_requests,
disable_by_file_path => $disable_by_file_path,
disable_by_file_paths => $disable_by_file_paths,
}
}

View File

@@ -0,0 +1,8 @@
---
features:
- |
The following parameters have been added to
the ``ironic::inspector::healthcheck`` class.
- ``allowed_source_ranges``
- ``ignore_proxied_requests``

View File

@@ -13,10 +13,12 @@ describe 'ironic::inspector::healthcheck' do
is_expected.to contain_ironic_inspector_config('healthcheck/enabled').with_value('<SERVICE DEFAULT>')
is_expected.to contain_oslo__healthcheck('ironic_inspector_config').with(
:detailed => '<SERVICE DEFAULT>',
:backends => '<SERVICE DEFAULT>',
:disable_by_file_path => '<SERVICE DEFAULT>',
:disable_by_file_paths => '<SERVICE DEFAULT>',
:detailed => '<SERVICE DEFAULT>',
:backends => '<SERVICE DEFAULT>',
:allowed_source_ranges => '<SERVICE DEFAULT>',
:ignore_proxied_requests => '<SERVICE DEFAULT>',
:disable_by_file_path => '<SERVICE DEFAULT>',
:disable_by_file_paths => '<SERVICE DEFAULT>',
)
end
end
@@ -24,11 +26,13 @@ describe 'ironic::inspector::healthcheck' do
context 'with specific parameters' do
let :params do
{
:enabled => true,
:detailed => true,
:backends => ['disable_by_file'],
:disable_by_file_path => '/etc/ironic-inspector/healthcheck/disabled',
:disable_by_file_paths => ['5050:/etc/ironic-inspector/healthcheck/disabled'],
:enabled => true,
:detailed => true,
:backends => ['disable_by_file'],
:allowed_source_ranges => ['10.0.0.0/24', '10.0.1.0/24'],
:ignore_proxied_requests => false,
:disable_by_file_path => '/etc/ironic-inspector/healthcheck/disabled',
:disable_by_file_paths => ['5050:/etc/ironic-inspector/healthcheck/disabled'],
}
end
@@ -36,10 +40,12 @@ describe 'ironic::inspector::healthcheck' do
is_expected.to contain_ironic_inspector_config('healthcheck/enabled').with_value(true)
is_expected.to contain_oslo__healthcheck('ironic_inspector_config').with(
:detailed => true,
:backends => ['disable_by_file'],
:disable_by_file_path => '/etc/ironic-inspector/healthcheck/disabled',
:disable_by_file_paths => ['5050:/etc/ironic-inspector/healthcheck/disabled'],
:detailed => true,
:backends => ['disable_by_file'],
:allowed_source_ranges => ['10.0.0.0/24', '10.0.1.0/24'],
:ignore_proxied_requests => false,
:disable_by_file_path => '/etc/ironic-inspector/healthcheck/disabled',
:disable_by_file_paths => ['5050:/etc/ironic-inspector/healthcheck/disabled'],
)
end
end