Added support for the rgw_swift_url parameter in the rgw.pp

This parameter is needed for the swift API if there is a load balancer
in front of the rados gateway servers. If not provided and the swift
access url is different than http://$::fqdn:port, the swift API is not
working (users get a connection error).

http://docs.ceph.com/docs/mimic/radosgw/config-ref/

Moreover, use the rgw_dns_name option both for civetweb and apache.
This is a valid option for both frontend types, and becomes necessary
if it has been changed at least once in the past.

Change-Id: I639d15e30b0ba6c94614c1650d4ea85258ae6ede
This commit is contained in:
Vangelis Tasoulas 2019-04-03 18:36:49 +02:00
parent 3ed8441323
commit 17ed08b3aa
No known key found for this signature in database
GPG Key ID: 15423A57A998DA61
3 changed files with 25 additions and 8 deletions

View File

@ -64,6 +64,9 @@
# [*rgw_frontends*] Arguments to the rgw frontend # [*rgw_frontends*] Arguments to the rgw frontend
# Optional. Default is 'civetweb port=7480'. # Optional. Default is 'civetweb port=7480'.
# #
# [*rgw_swift_url*] The URL for the Ceph Object Gateway Swift API.
# Optional. Default is http://$fqdn:7480.
#
# Deprecated Parameters: # Deprecated Parameters:
# #
# [*syslog*] Whether or not to log to syslog. # [*syslog*] Whether or not to log to syslog.
@ -84,6 +87,7 @@ define ceph::rgw (
$rgw_port = undef, $rgw_port = undef,
$frontend_type = 'civetweb', $frontend_type = 'civetweb',
$rgw_frontends = 'civetweb port=7480', $rgw_frontends = 'civetweb port=7480',
$rgw_swift_url = "http://${::fqdn}:7480",
$syslog = undef, $syslog = undef,
) { ) {
@ -103,6 +107,8 @@ define ceph::rgw (
"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_swift_url": value => $rgw_swift_url;
} }
if($frontend_type == 'civetweb') if($frontend_type == 'civetweb')
@ -114,7 +120,6 @@ define ceph::rgw (
elsif ( ( $frontend_type == 'apache-fastcgi' ) or ( $frontend_type == 'apache-proxy-fcgi' ) ) elsif ( ( $frontend_type == 'apache-fastcgi' ) or ( $frontend_type == 'apache-proxy-fcgi' ) )
{ {
ceph_config { ceph_config {
"client.${name}/rgw_dns_name": value => $rgw_dns_name;
"client.${name}/rgw_print_continue": value => $rgw_print_continue; "client.${name}/rgw_print_continue": value => $rgw_print_continue;
"client.${name}/rgw_socket_path": value => $rgw_socket_path; "client.${name}/rgw_socket_path": value => $rgw_socket_path;
} }

View File

@ -39,6 +39,8 @@ describe 'ceph::rgw' do
it { should contain_ceph_config('client.radosgw.civetweb/keyring').with_value('/etc/ceph/ceph.client.radosgw.civetweb.keyring') } it { should contain_ceph_config('client.radosgw.civetweb/keyring').with_value('/etc/ceph/ceph.client.radosgw.civetweb.keyring') }
it { should contain_ceph_config('client.radosgw.civetweb/log_file').with_value('/var/log/ceph/radosgw.log') } it { should contain_ceph_config('client.radosgw.civetweb/log_file').with_value('/var/log/ceph/radosgw.log') }
it { should contain_ceph_config('client.radosgw.civetweb/rgw_frontends').with_value('civetweb port=7480') } it { should contain_ceph_config('client.radosgw.civetweb/rgw_frontends').with_value('civetweb port=7480') }
it { should contain_ceph_config('client.radosgw.civetweb/rgw_dns_name').with_value('myhost.domain') }
it { should contain_ceph_config('client.radosgw.civetweb/rgw_swift_url').with_value('http://myhost.domain:7480') }
end end
describe "activated with custom civetweb params" do describe "activated with custom civetweb params" do
@ -51,6 +53,8 @@ describe 'ceph::rgw' do
:frontend_type => 'civetweb', :frontend_type => 'civetweb',
:rgw_frontends => 'civetweb port=7481', :rgw_frontends => 'civetweb port=7481',
:user => 'root', :user => 'root',
:rgw_dns_name => 'mydns.hostname',
:rgw_swift_url => 'https://mydns.hostname:443'
} }
end end
@ -59,6 +63,8 @@ describe 'ceph::rgw' do
it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') } it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.client.radosgw.custom.keyring') } it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.client.radosgw.custom.keyring') }
it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/radosgw.log') } it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/radosgw.log') }
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') }
end end
end end

View File

@ -39,6 +39,8 @@ 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_file('/var/lib/ceph/radosgw').with( it { should contain_file('/var/lib/ceph/radosgw').with(
:ensure => 'directory', :ensure => 'directory',
@ -65,13 +67,15 @@ 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'
} }
end end
@ -81,6 +85,8 @@ 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_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',