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. # that information back as part of a request.
# Defaults to $facts['os_service_default'] # 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*] # [*disable_by_file_path*]
# (Optional) Check the presence of a file to determine if an application # (Optional) Check the presence of a file to determine if an application
# is running on a port. # is running on a port.
@@ -28,11 +37,13 @@
# Defaults to $facts['os_service_default'] # Defaults to $facts['os_service_default']
# #
class ironic::inspector::healthcheck ( class ironic::inspector::healthcheck (
$enabled = $facts['os_service_default'], $enabled = $facts['os_service_default'],
$detailed = $facts['os_service_default'], $detailed = $facts['os_service_default'],
$backends = $facts['os_service_default'], $backends = $facts['os_service_default'],
$disable_by_file_path = $facts['os_service_default'], $allowed_source_ranges = $facts['os_service_default'],
$disable_by_file_paths = $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 include ironic::deps
@@ -42,9 +53,11 @@ class ironic::inspector::healthcheck (
} }
oslo::healthcheck { 'ironic_inspector_config': oslo::healthcheck { 'ironic_inspector_config':
detailed => $detailed, detailed => $detailed,
backends => $backends, backends => $backends,
disable_by_file_path => $disable_by_file_path, allowed_source_ranges => $allowed_source_ranges,
disable_by_file_paths => $disable_by_file_paths, 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_ironic_inspector_config('healthcheck/enabled').with_value('<SERVICE DEFAULT>')
is_expected.to contain_oslo__healthcheck('ironic_inspector_config').with( is_expected.to contain_oslo__healthcheck('ironic_inspector_config').with(
:detailed => '<SERVICE DEFAULT>', :detailed => '<SERVICE DEFAULT>',
:backends => '<SERVICE DEFAULT>', :backends => '<SERVICE DEFAULT>',
:disable_by_file_path => '<SERVICE DEFAULT>', :allowed_source_ranges => '<SERVICE DEFAULT>',
:disable_by_file_paths => '<SERVICE DEFAULT>', :ignore_proxied_requests => '<SERVICE DEFAULT>',
:disable_by_file_path => '<SERVICE DEFAULT>',
:disable_by_file_paths => '<SERVICE DEFAULT>',
) )
end end
end end
@@ -24,11 +26,13 @@ describe 'ironic::inspector::healthcheck' do
context 'with specific parameters' do context 'with specific parameters' do
let :params do let :params do
{ {
:enabled => true, :enabled => true,
:detailed => true, :detailed => true,
:backends => ['disable_by_file'], :backends => ['disable_by_file'],
:disable_by_file_path => '/etc/ironic-inspector/healthcheck/disabled', :allowed_source_ranges => ['10.0.0.0/24', '10.0.1.0/24'],
:disable_by_file_paths => ['5050:/etc/ironic-inspector/healthcheck/disabled'], :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
@@ -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_ironic_inspector_config('healthcheck/enabled').with_value(true)
is_expected.to contain_oslo__healthcheck('ironic_inspector_config').with( is_expected.to contain_oslo__healthcheck('ironic_inspector_config').with(
:detailed => true, :detailed => true,
:backends => ['disable_by_file'], :backends => ['disable_by_file'],
:disable_by_file_path => '/etc/ironic-inspector/healthcheck/disabled', :allowed_source_ranges => ['10.0.0.0/24', '10.0.1.0/24'],
:disable_by_file_paths => ['5050:/etc/ironic-inspector/healthcheck/disabled'], :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
end end