rgw: support more Swift-related options

This change improves the support coverage of radosgw options, which are
related to Swift API.

Change-Id: I1d544ebcbd77b44c1772d842e021a07e243997d6
This commit is contained in:
Takashi Kajinami
2022-08-22 00:19:56 +09:00
parent a41c255ab0
commit dbee5bacf3
3 changed files with 100 additions and 37 deletions

View File

@@ -68,27 +68,47 @@
# [*rgw_swift_url*] The URL for the Ceph Object Gateway Swift API. # [*rgw_swift_url*] The URL for the Ceph Object Gateway Swift API.
# Optional. Default is http://$fqdn:7480. # Optional. Default is http://$fqdn:7480.
# #
# [*rgw_swift_url_prefix*] The URL prefix for the Swift API.
# Optional. Default is 'swift'.
#
# [*rgw_swift_account_in_url*] Whether or not the Swift account name should
# be included in the Swift API URL.
# Optional. Default is false.
#
# [*rgw_swift_versioning_enabled*] Enables the Object Versioning of OpenStack
# Object Storage API
# Optional. Default is false.
#
# [*rgw_trust_forwarded_https*] Trust the Forwarded and X-Forwarded-Proto
# headers sent by the proxy when determining whether the connection is
# secure.
# Optional. Default is false
#
# Deprecated Parameters: # Deprecated Parameters:
# #
# [*syslog*] Whether or not to log to syslog. # [*syslog*] Whether or not to log to syslog.
# Optional. Default is true. # Optional. Default is true.
# #
define ceph::rgw ( define ceph::rgw (
$pkg_radosgw = $ceph::params::pkg_radosgw, $pkg_radosgw = $ceph::params::pkg_radosgw,
$rgw_ensure = 'running', $rgw_ensure = 'running',
$rgw_enable = true, $rgw_enable = true,
$rgw_data = "/var/lib/ceph/radosgw/ceph-${name}", $rgw_data = "/var/lib/ceph/radosgw/ceph-${name}",
$user = $ceph::params::user_radosgw, $user = $ceph::params::user_radosgw,
$keyring_path = "/etc/ceph/ceph.client.${name}.keyring", $keyring_path = "/etc/ceph/ceph.client.${name}.keyring",
$log_file = '/var/log/ceph/radosgw.log', $log_file = '/var/log/ceph/radosgw.log',
$rgw_dns_name = $::fqdn, $rgw_dns_name = $::fqdn,
$rgw_socket_path = $ceph::params::rgw_socket_path, $rgw_socket_path = $ceph::params::rgw_socket_path,
$rgw_print_continue = false, $rgw_print_continue = false,
$rgw_port = undef, $rgw_port = undef,
$frontend_type = 'civetweb', $frontend_type = 'civetweb',
$rgw_frontends = undef, $rgw_frontends = undef,
$rgw_swift_url = "http://${::fqdn}:7480", $rgw_swift_url = "http://${::fqdn}:7480",
$syslog = undef, $rgw_swift_url_prefix = 'swift',
$rgw_swift_account_in_url = false,
$rgw_swift_versioning_enabled = false,
$rgw_trust_forwarded_https = false,
$syslog = undef,
) { ) {
include stdlib include stdlib
@@ -103,12 +123,16 @@ define ceph::rgw (
} }
ceph_config { ceph_config {
"client.${name}/host": value => $::hostname; "client.${name}/host": value => $::hostname;
"client.${name}/keyring": value => $keyring_path; "client.${name}/keyring": value => $keyring_path;
"client.${name}/log_file": value => $log_file; "client.${name}/log_file": value => $log_file;
"client.${name}/user": value => $user; "client.${name}/user": value => $user;
"client.${name}/rgw_dns_name": value => $rgw_dns_name; "client.${name}/rgw_dns_name": value => $rgw_dns_name;
"client.${name}/rgw_swift_url": value => $rgw_swift_url; "client.${name}/rgw_swift_url": value => $rgw_swift_url;
"client.${name}/rgw_swift_account_in_url": value => $rgw_swift_account_in_url;
"client.${name}/rgw_swift_url_prefix": value => $rgw_swift_url_prefix;
"client.${name}/rgw_swift_versioning_enabled": value => $rgw_swift_versioning_enabled;
"client.${name}/rgw_trust_forwarded_https": value => $rgw_trust_forwarded_https;
} }
case $frontend_type { case $frontend_type {

View File

@@ -0,0 +1,9 @@
---
features:
- |
The ``ceph::rgw`` class now supports the following new parameters.
- ``rgw_swift_url_prefix``
- ``rgw_swift_account_in_url``
- ``rgw_swift_versioning_enabled``
- ``rgw_trust_forwarded_https``

View File

@@ -40,6 +40,10 @@ describe 'ceph::rgw' do
it { should contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') } it { should contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_dns_name').with_value('myhost.domain') } it { should contain_ceph_config('client.radosgw.gateway/rgw_dns_name').with_value('myhost.domain') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_url').with_value('http://myhost.domain:7480') } it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_url').with_value('http://myhost.domain:7480') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_url_prefix').with_value('swift') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_account_in_url').with_value(false) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_versioning_enabled').with_value(false) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_trust_forwarded_https').with_value(false) }
it { should contain_file('/var/lib/ceph/radosgw').with( it { should contain_file('/var/lib/ceph/radosgw').with(
:ensure => 'directory', :ensure => 'directory',
@@ -65,15 +69,19 @@ describe 'ceph::rgw' do
let :params do let :params do
{ {
:pkg_radosgw => 'pkgradosgw', :pkg_radosgw => 'pkgradosgw',
:rgw_ensure => 'stopped', :rgw_ensure => 'stopped',
:rgw_enable => false, :rgw_enable => false,
:rgw_data => '/var/lib/ceph/radosgw/ceph-radosgw.custom', :rgw_data => '/var/lib/ceph/radosgw/ceph-radosgw.custom',
:user => 'wwwuser', :user => 'wwwuser',
:keyring_path => '/etc/ceph/ceph.radosgw.custom.keyring', :keyring_path => '/etc/ceph/ceph.radosgw.custom.keyring',
:log_file => '/var/log/ceph/mylogfile.log', :log_file => '/var/log/ceph/mylogfile.log',
:rgw_dns_name => 'mydns.hostname', :rgw_dns_name => 'mydns.hostname',
:rgw_swift_url => 'https://mydns.hostname:443' :rgw_swift_url => 'https://mydns.hostname:443',
:rgw_swift_url_prefix => '/',
:rgw_swift_account_in_url => true,
:rgw_swift_versioning_enabled => true,
:rgw_trust_forwarded_https => true,
} }
end end
@@ -85,6 +93,10 @@ describe 'ceph::rgw' do
it { should contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') } it { should contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') }
it { should contain_ceph_config('client.radosgw.custom/rgw_dns_name').with_value('mydns.hostname') } it { should contain_ceph_config('client.radosgw.custom/rgw_dns_name').with_value('mydns.hostname') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_url').with_value('https://mydns.hostname:443') } it { should contain_ceph_config('client.radosgw.custom/rgw_swift_url').with_value('https://mydns.hostname:443') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_url_prefix').with_value('/') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_account_in_url').with_value(true) }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_versioning_enabled').with_value(true) }
it { should contain_ceph_config('client.radosgw.custom/rgw_trust_forwarded_https').with_value(true) }
it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with( it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with(
:ensure => 'directory', :ensure => 'directory',
@@ -116,6 +128,12 @@ describe 'ceph::rgw' do
it { should contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') } it { should contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.gateway/keyring').with_value('/etc/ceph/ceph.client.radosgw.gateway.keyring') } it { should contain_ceph_config('client.radosgw.gateway/keyring').with_value('/etc/ceph/ceph.client.radosgw.gateway.keyring') }
it { should contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') } it { should contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_dns_name').with_value('myhost.domain') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_url').with_value('http://myhost.domain:7480') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_url_prefix').with_value('swift') }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_account_in_url').with_value(false) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_versioning_enabled').with_value(false) }
it { should contain_ceph_config('client.radosgw.gateway/rgw_trust_forwarded_https').with_value(false) }
it { should contain_file('/var/lib/ceph/radosgw').with( it { should contain_file('/var/lib/ceph/radosgw').with(
:ensure => 'directory', :ensure => 'directory',
@@ -141,13 +159,19 @@ describe 'ceph::rgw' do
let :params do let :params do
{ {
:pkg_radosgw => 'pkgradosgw', :pkg_radosgw => 'pkgradosgw',
:rgw_ensure => 'stopped', :rgw_ensure => 'stopped',
:rgw_enable => false, :rgw_enable => false,
:rgw_data => "/var/lib/ceph/radosgw/ceph-radosgw.custom", :rgw_data => "/var/lib/ceph/radosgw/ceph-radosgw.custom",
:user => 'wwwuser', :user => 'wwwuser',
:keyring_path => "/etc/ceph/ceph.radosgw.custom.keyring", :keyring_path => "/etc/ceph/ceph.radosgw.custom.keyring",
:log_file => '/var/log/ceph/mylogfile.log', :log_file => '/var/log/ceph/mylogfile.log',
:rgw_dns_name => 'mydns.hostname',
:rgw_swift_url => 'https://mydns.hostname:443',
:rgw_swift_url_prefix => '/',
:rgw_swift_account_in_url => true,
:rgw_swift_versioning_enabled => true,
:rgw_trust_forwarded_https => true,
} }
end end
@@ -157,6 +181,12 @@ describe 'ceph::rgw' do
it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.radosgw.custom.keyring') } it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.radosgw.custom.keyring') }
it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/mylogfile.log') } it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/mylogfile.log') }
it { should contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') } it { should contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') }
it { should contain_ceph_config('client.radosgw.custom/rgw_dns_name').with_value('mydns.hostname') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_url').with_value('https://mydns.hostname:443') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_url_prefix').with_value('/') }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_account_in_url').with_value(true) }
it { should contain_ceph_config('client.radosgw.custom/rgw_swift_versioning_enabled').with_value(true) }
it { should contain_ceph_config('client.radosgw.custom/rgw_trust_forwarded_https').with_value(true) }
it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with( it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with(
:ensure => 'directory', :ensure => 'directory',