rgw: Add suport for the beast frontend library

The beast frontend library has been supported since Mimic and will
replace the civetweb library which was deprecated in Pacific.

This also fixes the rgw_frontneds parameter so that the reasonable
default value is selected according to the frontend type selected.

Change-Id: I2faac0151165aa296ac2df3a0b9a1255654947ef
This commit is contained in:
Takashi Kajinami
2022-08-21 00:50:00 +09:00
parent 152b6f6d27
commit a41c255ab0
4 changed files with 151 additions and 4 deletions

View File

@@ -59,10 +59,11 @@
# Optional. Default is undef.
#
# [*frontend_type*] What type of frontend to use
# Optional. Default is civetweb, Other options are apache-proxy-fcgi or apache-fastcgi.
# Optional. Default is civetweb, Other options are beast, apache-proxy-fcgi
# or apache-fastcgi.
#
# [*rgw_frontends*] Arguments to the rgw frontend
# Optional. Default is 'civetweb port=7480'.
# Optional. Default is undef.
#
# [*rgw_swift_url*] The URL for the Ceph Object Gateway Swift API.
# Optional. Default is http://$fqdn:7480.
@@ -85,7 +86,7 @@ define ceph::rgw (
$rgw_print_continue = false,
$rgw_port = undef,
$frontend_type = 'civetweb',
$rgw_frontends = 'civetweb port=7480',
$rgw_frontends = undef,
$rgw_swift_url = "http://${::fqdn}:7480",
$syslog = undef,
) {
@@ -111,6 +112,11 @@ define ceph::rgw (
}
case $frontend_type {
'beast': {
ceph::rgw::beast { $name:
rgw_frontends => $rgw_frontends,
}
}
'civetweb': {
ceph::rgw::civetweb { $name:
rgw_frontends => $rgw_frontends,
@@ -124,8 +130,9 @@ define ceph::rgw (
}
}
'apache-proxy-fcgi': {
$rgw_frontends_real = pick($rgw_frontends, 'fastcgi socket_port=9000 socket_host=127.0.0.1');
ceph_config {
"client.${name}/rgw_frontends": value => $rgw_frontends;
"client.${name}/rgw_frontends": value => $rgw_frontends_real;
"client.${name}/rgw_print_continue": value => $rgw_print_continue;
"client.${name}/rgw_socket_path": value => $rgw_socket_path;
}

35
manifests/rgw/beast.pp Normal file
View File

@@ -0,0 +1,35 @@
#
# Copyright (C) 2022 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Takashi Kajinami <tkajinam@redhat.com>
#
# Configures a ceph radosgw using beast.
#
# == Define: ceph::rgw::beast
# [*rgw_frontends*] Arguments to the rgw frontend
# Optional. Default is 'beast port=7480'
#
define ceph::rgw::beast (
$rgw_frontends = 'beast port=7480',
) {
unless $name =~ /^radosgw\..+/ {
fail("Define name must be started with 'radosgw.'")
}
ceph_config {
"client.${name}/rgw_frontends": value => $rgw_frontends;
}
}

View File

@@ -0,0 +1,5 @@
---
features:
- |
Now this module supports setting up the Ceph Object Gateway service with
the beast HTTP frontend library.

View File

@@ -0,0 +1,100 @@
#
# Copyright (C) 2022 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Takashi Kajinami <tkajinam@redhat.com>
#
require 'spec_helper'
describe 'ceph::rgw' do
let :pre_condition do
'include ceph::params'
end
shared_examples 'ceph rgw beast' do
describe "activated with beast params" do
let :title do
'radosgw.beast'
end
let :params do
{
:frontend_type => 'beast',
}
end
it { should contain_ceph_config('client.radosgw.beast/user').with_value("#{platform_params[:user]}") }
it { should contain_ceph_config('client.radosgw.beast/host').with_value('myhost') }
it { should contain_ceph_config('client.radosgw.beast/keyring').with_value('/etc/ceph/ceph.client.radosgw.beast.keyring') }
it { should contain_ceph_config('client.radosgw.beast/log_file').with_value('/var/log/ceph/radosgw.log') }
it { should contain_ceph_config('client.radosgw.beast/rgw_frontends').with_value('beast port=7480') }
it { should contain_ceph_config('client.radosgw.beast/rgw_dns_name').with_value('myhost.domain') }
it { should contain_ceph_config('client.radosgw.beast/rgw_swift_url').with_value('http://myhost.domain:7480') }
end
describe "activated with custom beast params" do
let :title do
'radosgw.custom'
end
let :params do
{
:frontend_type => 'beast',
:rgw_frontends => 'beast endpoint=0.0.0.0:8080 port=8080',
:user => 'root',
:rgw_dns_name => 'mydns.hostname',
:rgw_swift_url => 'https://mydns.hostname:443'
}
end
it { should contain_ceph_config('client.radosgw.custom/rgw_frontends').with_value('beast endpoint=0.0.0.0:8080 port=8080') }
it { should contain_ceph_config('client.radosgw.custom/user').with_value('root') }
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
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({
:concat_basedir => '/var/lib/puppet/concat',
:fqdn => 'myhost.domain',
:hostname => 'myhost',
}))
end
let :platform_params do
case facts[:osfamily]
when 'Debian'
{
:pkg_radosgw => 'radosgw',
:user => 'www-data',
}
when 'RedHat'
{
:pkg_radosgw => 'ceph-radosgw',
:user => 'apache',
}
end
end
it_behaves_like 'ceph rgw beast'
end
end
end