Merge "Add new option for api: public_endpoint"

This commit is contained in:
Zuul 2022-09-05 19:30:23 +00:00 committed by Gerrit Code Review
commit 4478a256d8
3 changed files with 22 additions and 0 deletions

View File

@ -225,6 +225,14 @@
# by the user executing the agent
# Defaults to: $::glance::params::lock_path
#
# [*public_endpoint*]
# (optional) Public url endpoint to use for Glance versions response.
# Change the endpoint to represent the proxy URL if the API service is
# running behind a proxy. This is especially useful if the public endpoint
# is advertised with a base URL not pointing to the server root in Keystone.
# ie. https://cloud.acme.org/api/image
# Default: $::os_service_default.
#
# DEPRECATED PARAMETERS
#
# [*stores*]
@ -342,6 +350,7 @@ class glance::api(
$limit_param_default = $::os_service_default,
$api_limit_max = $::os_service_default,
$lock_path = $::glance::params::lock_path,
$public_endpoint = $::os_service_default,
# DEPRECATED PARAMETERS
$stores = undef,
$default_store = undef,
@ -435,6 +444,7 @@ class glance::api(
'DEFAULT/user_storage_quota': value => $user_storage_quota;
'DEFAULT/limit_param_default': value => $limit_param_default;
'DEFAULT/api_limit_max': value => $api_limit_max;
'DEFAULT/public_endpoint': value => $public_endpoint;
}
if $show_multiple_locations {

View File

@ -0,0 +1,9 @@
---
features:
- |
The ``glance::api`` class accepts a new parameter ``public_endpoint``.
This is especially useful if you have a proxy or load balancer that
rewrites the base URL of the image API. If the image API is advertised as
``https://cloud.acme.org/api/image`` in Keystone, you will need to set
this option to the full value of the endpoint to have glance API
advertise the correct URLs to clients.

View File

@ -54,6 +54,7 @@ describe 'glance::api' do
:sync_db => true,
:limit_param_default => '<SERVICE DEFAULT>',
:api_limit_max => '<SERVICE DEFAULT>',
:public_endpoint => '<SERVICE DEFAULT>',
}
end
@ -96,6 +97,7 @@ describe 'glance::api' do
:sync_db => false,
:limit_param_default => '10',
:api_limit_max => '10',
:public_endpoint => 'https://cloud.acme.org/api/image',
}
].each do |param_set|
@ -155,6 +157,7 @@ describe 'glance::api' do
'user_storage_quota',
'limit_param_default',
'api_limit_max',
'public_endpoint',
].each do |config|
is_expected.to contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end