Improves support for ceph-mds
This change adds a profile for the MDS service and extends the existing MDS class to enable the service on boot and set the daemon binding address. Change-Id: I558b43deaa9b243c54f3d7ae945f11dd4925eb5d Related-Bug: #1644784
This commit is contained in:
@@ -20,26 +20,95 @@
|
|||||||
#
|
#
|
||||||
# === Parameters:
|
# === Parameters:
|
||||||
#
|
#
|
||||||
|
# [*public_addr*] The bind IP address.
|
||||||
|
# Optional. The IPv(4|6) address on which MDS binds itself.
|
||||||
|
#
|
||||||
|
# [*pkg_mds*] Package name for the MDS service.
|
||||||
|
# Optional. Defaults to the value of ceph::params::pkg_mds
|
||||||
|
#
|
||||||
|
# [*pkg_mds_ensure*] Ensure status for the pkg_mds package resources
|
||||||
|
# Optional. Defaults to present.
|
||||||
|
#
|
||||||
# [*mds_activate*] Switch to activate the '[mds]' section in the config.
|
# [*mds_activate*] Switch to activate the '[mds]' section in the config.
|
||||||
# Optional. Defaults to 'true'.
|
# Optional. Defaults to true.
|
||||||
#
|
#
|
||||||
# [*mds_data*] The path to the MDS data.
|
# [*mds_data*] The path to the MDS data.
|
||||||
# Optional. Default provided by Ceph is '/var/lib/ceph/mds/$cluster-$id'.
|
# Optional. Same default as ceph.
|
||||||
|
#
|
||||||
|
# [*mds_enable*] Whether to enable ceph-mds instance on boot.
|
||||||
|
# Optional. Default is true.
|
||||||
|
#
|
||||||
|
# [*mds_ensure*] Whether to start the MDS service.
|
||||||
|
# Optional. Default is running.
|
||||||
|
#
|
||||||
|
# [*mds_id*] The ID of the MDS instance.
|
||||||
|
# Optional. Default is $::hostname
|
||||||
#
|
#
|
||||||
# [*keyring*] The location of the keyring used by MDSs
|
# [*keyring*] The location of the keyring used by MDSs
|
||||||
# Optional. Defaults to /var/lib/ceph/mds/$cluster-$id/keyring.
|
# Optional. Same default as ceph.
|
||||||
|
#
|
||||||
|
# [*cluster*] The ceph cluster
|
||||||
|
# Optional. Default to 'ceph'.
|
||||||
#
|
#
|
||||||
class ceph::mds (
|
class ceph::mds (
|
||||||
|
$public_addr = undef,
|
||||||
|
$pkg_mds = $::ceph::params::pkg_mds,
|
||||||
|
$pkg_mds_ensure = present,
|
||||||
$mds_activate = true,
|
$mds_activate = true,
|
||||||
$mds_data = '/var/lib/ceph/mds/$cluster-$id',
|
$mds_data = undef,
|
||||||
$keyring = '/var/lib/ceph/mds/$cluster-$id/keyring',
|
$mds_enable = true,
|
||||||
) {
|
$mds_ensure = 'running',
|
||||||
|
$mds_id = $::hostname,
|
||||||
|
$keyring = undef,
|
||||||
|
$cluster = 'ceph',
|
||||||
|
) inherits ceph::params {
|
||||||
|
if $mds_data {
|
||||||
|
$mds_data_real = $mds_data
|
||||||
|
} else {
|
||||||
|
$mds_data_real = "/var/lib/ceph/mds/${cluster}-${mds_id}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if $keyring {
|
||||||
|
$keyring_real = $keyring
|
||||||
|
} else {
|
||||||
|
$keyring_real = "${mds_data_real}/keyring"
|
||||||
|
}
|
||||||
|
|
||||||
|
Ceph_config<||> ~> Service<| tag == 'ceph-mds' |>
|
||||||
|
Package<| tag == 'ceph' |>
|
||||||
|
-> File[$mds_data_real]
|
||||||
|
-> Service<| tag == 'ceph-mds' |>
|
||||||
|
|
||||||
|
$mds_service_name = "ceph-mds@${mds_id}"
|
||||||
|
|
||||||
|
service { $mds_service_name:
|
||||||
|
ensure => $mds_ensure,
|
||||||
|
enable => $mds_enable,
|
||||||
|
tag => ['ceph-mds']
|
||||||
|
}
|
||||||
|
|
||||||
|
package { $pkg_mds:
|
||||||
|
ensure => $pkg_mds_ensure,
|
||||||
|
tag => 'ceph',
|
||||||
|
}
|
||||||
|
|
||||||
|
file { $mds_data_real:
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'ceph',
|
||||||
|
group => 'ceph',
|
||||||
|
mode => '0750',
|
||||||
|
selinux_ignore_defaults => true,
|
||||||
|
}
|
||||||
|
|
||||||
# [mds]
|
|
||||||
if $mds_activate {
|
if $mds_activate {
|
||||||
ceph_config {
|
ceph_config {
|
||||||
'mds/mds_data': value => $mds_data;
|
'mds/mds_data': value => $mds_data_real;
|
||||||
'mds/keyring': value => $keyring;
|
'mds/keyring': value => $keyring_real;
|
||||||
|
}
|
||||||
|
if $public_addr {
|
||||||
|
ceph_config {
|
||||||
|
"mds.${mds_id}/public_addr": value => $public_addr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ceph_config {
|
ceph_config {
|
||||||
|
@@ -47,6 +47,7 @@ class ceph::params (
|
|||||||
$enable_sig = false,
|
$enable_sig = false,
|
||||||
$release = 'jewel',
|
$release = 'jewel',
|
||||||
) {
|
) {
|
||||||
|
$pkg_mds = 'ceph-mds'
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'Debian': {
|
'Debian': {
|
||||||
|
41
manifests/profile/mds.pp
Normal file
41
manifests/profile/mds.pp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2016 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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: Giulio Fidente <gfidente@redhat.com>
|
||||||
|
#
|
||||||
|
# == Class: ceph::profile::mds
|
||||||
|
#
|
||||||
|
# Profile for a Ceph mds
|
||||||
|
#
|
||||||
|
class ceph::profile::mds {
|
||||||
|
require ::ceph::profile::base
|
||||||
|
|
||||||
|
class { '::ceph::mds':
|
||||||
|
public_addr => $ceph::profile::params::public_addr,
|
||||||
|
}
|
||||||
|
|
||||||
|
if !empty($ceph::profile::params::mds_key) {
|
||||||
|
ceph::key { "mds.${::hostname}":
|
||||||
|
cap_mon => 'allow profile mds',
|
||||||
|
cap_osd => 'allow rwx',
|
||||||
|
cap_mds => 'allow',
|
||||||
|
inject => true,
|
||||||
|
keyring_path => "/var/lib/ceph/mds/ceph-${::hostname}/keyring",
|
||||||
|
secret => $ceph::profile::params::mds_key,
|
||||||
|
user => 'ceph',
|
||||||
|
group => 'ceph'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -91,6 +91,9 @@
|
|||||||
# This is useful when not specifying public_network or when there is more than one IP address on
|
# This is useful when not specifying public_network or when there is more than one IP address on
|
||||||
# the same network and you want to be specific about the IP to bind the MON on.
|
# the same network and you want to be specific about the IP to bind the MON on.
|
||||||
#
|
#
|
||||||
|
# [*mds_key*] The mds secret key.
|
||||||
|
# Optional but required when using cephx.
|
||||||
|
#
|
||||||
# [*mon_key*] The mon secret key.
|
# [*mon_key*] The mon secret key.
|
||||||
# Optional. Either mon_key or mon_keyring need to be set when using cephx.
|
# Optional. Either mon_key or mon_keyring need to be set when using cephx.
|
||||||
#
|
#
|
||||||
@@ -189,6 +192,7 @@ class ceph::profile::params (
|
|||||||
$cluster_network = undef,
|
$cluster_network = undef,
|
||||||
$public_network = undef,
|
$public_network = undef,
|
||||||
$public_addr = undef,
|
$public_addr = undef,
|
||||||
|
$mds_key = undef,
|
||||||
$mon_key = undef,
|
$mon_key = undef,
|
||||||
$mon_keyring = undef,
|
$mon_keyring = undef,
|
||||||
$client_keys = {},
|
$client_keys = {},
|
||||||
|
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
prelude: >
|
||||||
|
Improves support for the MDS service and adds a profile class for it.
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The MDS class is extended to allow for binding address and instance ID
|
||||||
|
configuration. It now also ensures that the needed packages for the MDS
|
||||||
|
daemon are installed and that the service is manageable by Puppet.
|
||||||
|
- |
|
||||||
|
A new MDS profile class is added which, in addition to deploying the MDS
|
||||||
|
service will create a new keyring for it, allowing MDS profilation and
|
||||||
|
access to the OSD pools.
|
||||||
|
other:
|
||||||
|
- |
|
||||||
|
The package installed by default for the MDS service can be configured
|
||||||
|
via ceph::params::pkg_mds
|
||||||
|
- |
|
||||||
|
The keyring for the MDS service is only created if a key is given, the
|
||||||
|
key to use can be configured via ceph::profile::params::mds_key
|
@@ -21,14 +21,16 @@ describe 'ceph::mds' do
|
|||||||
shared_examples_for 'ceph mds' do
|
shared_examples_for 'ceph mds' do
|
||||||
describe "activated with default params" do
|
describe "activated with default params" do
|
||||||
|
|
||||||
it { is_expected.to contain_ceph_config('mds/mds_data').with_value('/var/lib/ceph/mds/$cluster-$id') }
|
it { is_expected.to contain_ceph_config('mds/mds_data').with_value('/var/lib/ceph/mds/ceph-myhostname') }
|
||||||
it { is_expected.to contain_ceph_config('mds/keyring').with_value('/var/lib/ceph/mds/$cluster-$id/keyring') }
|
it { is_expected.to contain_ceph_config('mds/keyring').with_value('/var/lib/ceph/mds/ceph-myhostname/keyring') }
|
||||||
|
it { is_expected.to contain_package('ceph-mds').with('ensure' => 'present') }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "activated with custom params" do
|
describe "activated with custom params" do
|
||||||
let :params do
|
let :params do
|
||||||
{
|
{
|
||||||
|
:public_addr => '1.2.3.4',
|
||||||
|
:mds_id => 'mymds',
|
||||||
:mds_data => '/usr/local/ceph/var/lib/mds/_cluster-_id',
|
:mds_data => '/usr/local/ceph/var/lib/mds/_cluster-_id',
|
||||||
:keyring => '/usr/local/ceph/var/lib/mds/_cluster-_id/keyring'
|
:keyring => '/usr/local/ceph/var/lib/mds/_cluster-_id/keyring'
|
||||||
}
|
}
|
||||||
@@ -36,7 +38,18 @@ describe 'ceph::mds' do
|
|||||||
|
|
||||||
it { is_expected.to contain_ceph_config('mds/mds_data').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id') }
|
it { is_expected.to contain_ceph_config('mds/mds_data').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id') }
|
||||||
it { is_expected.to contain_ceph_config('mds/keyring').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id/keyring') }
|
it { is_expected.to contain_ceph_config('mds/keyring').with_value('/usr/local/ceph/var/lib/mds/_cluster-_id/keyring') }
|
||||||
|
it { is_expected.to contain_package('ceph-mds').with('ensure' => 'present') }
|
||||||
|
it {
|
||||||
|
is_expected.to contain_service('ceph-mds@mymds').with('ensure' => 'running')
|
||||||
|
}
|
||||||
|
it { is_expected.to contain_ceph_config('mds.mymds/public_addr').with_value('1.2.3.4') }
|
||||||
|
it { is_expected.to contain_file('/usr/local/ceph/var/lib/mds/_cluster-_id').with( {
|
||||||
|
'ensure' => 'directory',
|
||||||
|
'owner' => 'ceph',
|
||||||
|
'group' => 'ceph',
|
||||||
|
'mode' => '0750',
|
||||||
|
'selinux_ignore_defaults' => true,
|
||||||
|
} ) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "not activated" do
|
describe "not activated" do
|
||||||
@@ -46,8 +59,6 @@ describe 'ceph::mds' do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to_not contain_ceph_config('mds/mds_data').with_value('/var/lib/ceph/mds/_cluster-_id') }
|
|
||||||
it { is_expected.to_not contain_ceph_config('mds/keyring').with_value('/var/lib/ceph/mds/_cluster-_id/keyring') }
|
|
||||||
it { is_expected.to contain_ceph_config('mds/mds_data').with_ensure('absent') }
|
it { is_expected.to contain_ceph_config('mds/mds_data').with_ensure('absent') }
|
||||||
it { is_expected.to contain_ceph_config('mds/keyring').with_ensure('absent') }
|
it { is_expected.to contain_ceph_config('mds/keyring').with_ensure('absent') }
|
||||||
|
|
||||||
@@ -59,7 +70,7 @@ describe 'ceph::mds' do
|
|||||||
}).each do |os,facts|
|
}).each do |os,facts|
|
||||||
context "on #{os}" do
|
context "on #{os}" do
|
||||||
let (:facts) do
|
let (:facts) do
|
||||||
facts.merge!(OSDefaults.get_facts())
|
facts.merge!(OSDefaults.get_facts({:hostname => 'myhostname'}))
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like 'ceph mds'
|
it_behaves_like 'ceph mds'
|
||||||
|
50
spec/classes/ceph_profile_mds_spec.rb
Normal file
50
spec/classes/ceph_profile_mds_spec.rb
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2016 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# 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: Giulio Fidente <gfidente@redhat.com>
|
||||||
|
#
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'ceph::profile::mds' do
|
||||||
|
|
||||||
|
shared_examples_for 'ceph profile mds' do
|
||||||
|
|
||||||
|
it { is_expected.to contain_class('ceph::mds').with(
|
||||||
|
'public_addr' => '10.11.12.2',
|
||||||
|
)}
|
||||||
|
it { is_expected.to contain_ceph__key('mds.myhostname').with(
|
||||||
|
:cap_mon => 'allow profile mds',
|
||||||
|
:cap_osd => 'allow rwx',
|
||||||
|
:cap_mds => 'allow',
|
||||||
|
:inject => true,
|
||||||
|
:keyring_path => "/var/lib/ceph/mds/ceph-myhostname/keyring",
|
||||||
|
:secret => 'AQDLOh1VgEp6FRAAFzT7Zw+Y9V6JJExQAsRnRQ==',
|
||||||
|
:user => 'ceph',
|
||||||
|
:group => 'ceph'
|
||||||
|
)}
|
||||||
|
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({:hostname => 'myhostname'}))
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'ceph profile mds'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
1
spec/fixtures/hieradata/common.yaml
vendored
1
spec/fixtures/hieradata/common.yaml
vendored
@@ -25,6 +25,7 @@ ceph::profile::params::osd_max_scrubs: '1'
|
|||||||
ceph::profile::params::osd_op_threads: '2'
|
ceph::profile::params::osd_op_threads: '2'
|
||||||
|
|
||||||
######## Keys
|
######## Keys
|
||||||
|
ceph::profile::params::mds_key: 'AQDLOh1VgEp6FRAAFzT7Zw+Y9V6JJExQAsRnRQ=='
|
||||||
ceph::profile::params::mon_key: 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg=='
|
ceph::profile::params::mon_key: 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg=='
|
||||||
ceph::profile::params::client_keys:
|
ceph::profile::params::client_keys:
|
||||||
'client.admin':
|
'client.admin':
|
||||||
|
Reference in New Issue
Block a user