From 17ed08b3aa91f1784ed200b6733168e8f7103a5e Mon Sep 17 00:00:00 2001 From: Vangelis Tasoulas Date: Wed, 3 Apr 2019 18:36:49 +0200 Subject: [PATCH] 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 --- manifests/rgw.pp | 7 ++++++- spec/defines/ceph_rgw_civetweb_spec.rb | 6 ++++++ spec/defines/ceph_rgw_spec.rb | 20 +++++++++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/manifests/rgw.pp b/manifests/rgw.pp index e703e018..d8b22b12 100644 --- a/manifests/rgw.pp +++ b/manifests/rgw.pp @@ -64,6 +64,9 @@ # [*rgw_frontends*] Arguments to the rgw frontend # 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: # # [*syslog*] Whether or not to log to syslog. @@ -84,6 +87,7 @@ define ceph::rgw ( $rgw_port = undef, $frontend_type = 'civetweb', $rgw_frontends = 'civetweb port=7480', + $rgw_swift_url = "http://${::fqdn}:7480", $syslog = undef, ) { @@ -103,6 +107,8 @@ define ceph::rgw ( "client.${name}/keyring": value => $keyring_path; "client.${name}/log_file": value => $log_file; "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') @@ -114,7 +120,6 @@ define ceph::rgw ( elsif ( ( $frontend_type == 'apache-fastcgi' ) or ( $frontend_type == 'apache-proxy-fcgi' ) ) { ceph_config { - "client.${name}/rgw_dns_name": value => $rgw_dns_name; "client.${name}/rgw_print_continue": value => $rgw_print_continue; "client.${name}/rgw_socket_path": value => $rgw_socket_path; } diff --git a/spec/defines/ceph_rgw_civetweb_spec.rb b/spec/defines/ceph_rgw_civetweb_spec.rb index 27ca0812..b4f413f0 100644 --- a/spec/defines/ceph_rgw_civetweb_spec.rb +++ b/spec/defines/ceph_rgw_civetweb_spec.rb @@ -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/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_dns_name').with_value('myhost.domain') } + it { should contain_ceph_config('client.radosgw.civetweb/rgw_swift_url').with_value('http://myhost.domain:7480') } end describe "activated with custom civetweb params" do @@ -51,6 +53,8 @@ describe 'ceph::rgw' do :frontend_type => 'civetweb', :rgw_frontends => 'civetweb port=7481', :user => 'root', + :rgw_dns_name => 'mydns.hostname', + :rgw_swift_url => 'https://mydns.hostname:443' } 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/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/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 diff --git a/spec/defines/ceph_rgw_spec.rb b/spec/defines/ceph_rgw_spec.rb index 98daaba6..06ac9b07 100644 --- a/spec/defines/ceph_rgw_spec.rb +++ b/spec/defines/ceph_rgw_spec.rb @@ -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/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/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( :ensure => 'directory', @@ -65,13 +67,15 @@ describe 'ceph::rgw' do let :params do { - :pkg_radosgw => 'pkgradosgw', - :rgw_ensure => 'stopped', - :rgw_enable => false, - :rgw_data => "/var/lib/ceph/radosgw/ceph-radosgw.custom", - :user => 'wwwuser', - :keyring_path => "/etc/ceph/ceph.radosgw.custom.keyring", - :log_file => '/var/log/ceph/mylogfile.log', + :pkg_radosgw => 'pkgradosgw', + :rgw_ensure => 'stopped', + :rgw_enable => false, + :rgw_data => "/var/lib/ceph/radosgw/ceph-radosgw.custom", + :user => 'wwwuser', + :keyring_path => "/etc/ceph/ceph.radosgw.custom.keyring", + :log_file => '/var/log/ceph/mylogfile.log', + :rgw_dns_name => 'mydns.hostname', + :rgw_swift_url => 'https://mydns.hostname:443' } 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/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/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( :ensure => 'directory',