Run designate-api under apache

Designate should be run under apache for production deployments.

Change-Id: I3b566d3da33ff583e47ce241f02da19ec889bcc3
This commit is contained in:
Brent Eagles 2021-11-05 16:32:33 -02:30 committed by Takashi Kajinami
parent 1d108772fd
commit d674f63e91
2 changed files with 64 additions and 15 deletions

View File

@ -23,27 +23,75 @@
# for more details. # for more details.
# Defaults to hiera('step') # Defaults to hiera('step')
# #
# [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
# it will create.
# Example with hiera:
# apache_certificates_specs:
# httpd-internal_api:
# hostname: <overcloud controller fqdn>
# service_certificate: <service certificate path>
# service_key: <service key path>
# principal: "haproxy/<overcloud controller fqdn>"
# Defaults to hiera('apache_certificate_specs', {}).
#
# [*enable_internal_tls*]
# (Optional) Whether TLS in the internal network is enabled or not.
# Defaults to hiera('enable_internal_tls', false)
#
# [*designate_network*]
# (Optional) The network name where the designate endpoint is listening on.
# This is set by t-h-t.
# Defaults to hiera('designate_api_network', undef)
#
# DEPRECATED PARAMETERS
#
# [*listen_ip*] # [*listen_ip*]
# (Optional) The IP on which the API should listen. # (Optional) The IP on which the API should listen. (now set by hiera via
# Defaults to 0.0.0.0 # designate::wsgi::apache)
# Defaults to undef
# #
# [*listen_port*] # [*listen_port*]
# (Optional) The port on which the API should listen. # (Optional) The port on which the API should listen. (no longer needed,
# Defaults to 9001 # listen port gets default value from designate::wsgi::apache)
# Defaults to undef
# #
class tripleo::profile::base::designate::api ( class tripleo::profile::base::designate::api (
$step = Integer(hiera('step')), $step = Integer(hiera('step')),
$listen_ip = '0.0.0.0', $certificates_specs = hiera('apache_certificates_specs', {}),
$listen_port = '9001', $enable_internal_tls = hiera('enable_internal_tls', false),
$designate_network = hiera('designate_api_network', undef),
$listen_ip = undef,
$listen_port = undef
) { ) {
include tripleo::profile::base::designate include tripleo::profile::base::designate
include tripleo::profile::base::designate::authtoken include tripleo::profile::base::designate::authtoken
if $enable_internal_tls {
if !$designate_network {
fail('designate_api_network is not set in the hieradata.')
}
$tls_certfile = $certificates_specs["httpd-${designate_network}"]['service_certificate']
$tls_keyfile = $certificates_specs["httpd-${designate_network}"]['service_key']
} else {
$tls_certfile = undef
$tls_keyfile = undef
}
if ($step >= 3) { if ($step >= 3) {
# TODO: remove once the tripleo heat template changes merge
if $listen_ip and $listen_port {
$listen_uri = normalize_ip_for_uri($listen_ip) $listen_uri = normalize_ip_for_uri($listen_ip)
class { 'designate::api': class { 'designate::api':
listen => "${listen_uri}:${listen_port}", listen => "${listen_uri}:${listen_port}"
}
} else {
include tripleo::profile::base::apache
class { 'designate::wsgi::apache':
ssl_cert => $tls_certfile,
ssl_key => $tls_keyfile
}
include designate::api
} }
include designate::healthcheck include designate::healthcheck
} }

View File

@ -41,6 +41,8 @@ eos
is_expected.to contain_class('tripleo::profile::base::designate::api') is_expected.to contain_class('tripleo::profile::base::designate::api')
is_expected.to contain_class('tripleo::profile::base::designate') is_expected.to contain_class('tripleo::profile::base::designate')
is_expected.to contain_class('tripleo::profile::base::designate::authtoken') is_expected.to contain_class('tripleo::profile::base::designate::authtoken')
is_expected.to_not contain_class('tripleo::profile::base::apache')
is_expected.to_not contain_class('designate::wsgi::apache')
is_expected.to_not contain_class('designate::api') is_expected.to_not contain_class('designate::api')
is_expected.to_not contain_class('designate::healthcheck') is_expected.to_not contain_class('designate::healthcheck')
} }
@ -55,13 +57,12 @@ eos
is_expected.to contain_class('tripleo::profile::base::designate::api') is_expected.to contain_class('tripleo::profile::base::designate::api')
is_expected.to contain_class('tripleo::profile::base::designate') is_expected.to contain_class('tripleo::profile::base::designate')
is_expected.to contain_class('tripleo::profile::base::designate::authtoken') is_expected.to contain_class('tripleo::profile::base::designate::authtoken')
is_expected.to contain_class('designate::api').with( is_expected.to contain_class('tripleo::profile::base::apache')
:listen => '0.0.0.0:9001' is_expected.to contain_class('designate::wsgi::apache')
) is_expected.to contain_class('designate::api')
is_expected.to contain_class('designate::healthcheck') is_expected.to contain_class('designate::healthcheck')
} }
end end
end end