]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
Add support for polling Radosgw metrics
authorTakashi Kajinami <tkajinam@redhat.com>
Mon, 8 Nov 2021 15:28:19 +0000 (00:28 +0900)
committerTakashi Kajinami <tkajinam@redhat.com>
Tue, 9 Nov 2021 02:30:55 +0000 (02:30 +0000)
Ceilometer supports polling metrics from the Radosgw service using
radosgw.* pollsters. This change introduces support for the parameters
required to use that feature.

Change-Id: I58be60247bba1483f49f830802d422109ff13930

manifests/agent/polling/rgw.pp [new file with mode: 0644]
manifests/agent/polling/service_types.pp
releasenotes/notes/rgw-support-35ca7afb8e5ec322.yaml [new file with mode: 0644]
spec/classes/ceilometer_agent_polling_rgw_spec.rb [new file with mode: 0644]
spec/classes/ceilometer_agent_polling_service_types_spec.rb

diff --git a/manifests/agent/polling/rgw.pp b/manifests/agent/polling/rgw.pp
new file mode 100644 (file)
index 0000000..a1845ed
--- /dev/null
@@ -0,0 +1,32 @@
+# == Class: ceilometer::agent::polling::rgw
+#
+# Configure rgw parameters
+#
+# === Parameters
+#
+# [*access_key*]
+#  (Optional) Access key for Radosgw Admin.
+#  Defaults to $::os_service_default
+#
+# [*secret_key*]
+#  (Optional) Secret key for Radosgw Admin.
+#  Defaults to $::os_service_default
+#
+# [*implicit_tenants*]
+#  (Optional) Whether RGW uses implicit tenants or not.
+#  Defaults to $::os_service_default
+#
+class ceilometer::agent::polling::rgw (
+  $access_key       = $::os_service_default,
+  $secret_key       = $::os_service_default,
+  $implicit_tenants = $::os_service_default,
+) {
+
+  include ceilometer::deps
+
+  ceilometer_config {
+    'rgw_admin_credentials/access_key': value => $access_key, secret => true;
+    'rgw_admin_credentials/secret_key': value => $secret_key, secret => true;
+    'rgw_client/implicit_tenants':      value => $implicit_tenants;
+  }
+}
index 19e017eaa8f132fbf6964d3eed2c3389ee57262e..d07bb9f14a552fe64432c98fe79ddb44183d3ad9 100644 (file)
 #   (Optional) cinder service type.
 #   Defaults to $::os_service_default
 #
+# [*radosgw*]
+#   (Optional) Radosgw service type.
+#   Defaults to $::os_service_default
+#
 class ceilometer::agent::polling::service_types (
   $glance  = $::os_service_default,
   $neutron = $::os_service_default,
   $nova    = $::os_service_default,
   $swift   = $::os_service_default,
   $cinder  = $::os_service_default,
+  $radosgw = $::os_service_default,
 ) {
 
   include ceilometer::deps
@@ -40,5 +45,6 @@ class ceilometer::agent::polling::service_types (
     'service_types/nova':    value => $nova;
     'service_types/swift':   value => $swift;
     'service_types/cinder':  value => $cinder;
+    'service_types/radosgw': value => $radosgw;
   }
 }
diff --git a/releasenotes/notes/rgw-support-35ca7afb8e5ec322.yaml b/releasenotes/notes/rgw-support-35ca7afb8e5ec322.yaml
new file mode 100644 (file)
index 0000000..ef683fb
--- /dev/null
@@ -0,0 +1,5 @@
+---
+features:
+  - |
+    Support for the parameters used to poll metrics from the Radosgw service
+    has been added.
diff --git a/spec/classes/ceilometer_agent_polling_rgw_spec.rb b/spec/classes/ceilometer_agent_polling_rgw_spec.rb
new file mode 100644 (file)
index 0000000..326d174
--- /dev/null
@@ -0,0 +1,41 @@
+require 'spec_helper'
+
+describe 'ceilometer::agent::polling::rgw' do
+  shared_examples 'ceilometer::agent::polling::rgw' do
+    context 'with default parameters' do
+      it 'configures the default values' do
+        is_expected.to contain_ceilometer_config('rgw_admin_credentials/access_key').with_value('<SERVICE DEFAULT>').with_secret(true)
+        is_expected.to contain_ceilometer_config('rgw_admin_credentials/secret_key').with_value('<SERVICE DEFAULT>').with_secret(true)
+        is_expected.to contain_ceilometer_config('rgw_client/implicit_tenants').with_value('<SERVICE DEFAULT>')
+      end
+    end
+
+    context 'with overridden parameters' do
+      let :params do
+        {
+          :access_key       => 'access',
+          :secret_key       => 'secret',
+          :implicit_tenants => true,
+        }
+      end
+
+      it 'configures the overridden values' do
+        is_expected.to contain_ceilometer_config('rgw_admin_credentials/access_key').with_value('access')
+        is_expected.to contain_ceilometer_config('rgw_admin_credentials/secret_key').with_value('secret')
+        is_expected.to contain_ceilometer_config('rgw_client/implicit_tenants').with_value(true)
+      end
+    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())
+      end
+
+      it_behaves_like 'ceilometer::agent::polling::rgw'
+    end
+  end
+end
index aa7c21a29ecea407690b12435d8a7987b4d4d1b3..adddfdf62e04cc1df4952077348353695d85151f 100644 (file)
@@ -9,6 +9,7 @@ describe 'ceilometer::agent::polling::service_types' do
         is_expected.to contain_ceilometer_config('service_types/nova').with_value('<SERVICE DEFAULT>')
         is_expected.to contain_ceilometer_config('service_types/swift').with_value('<SERVICE DEFAULT>')
         is_expected.to contain_ceilometer_config('service_types/cinder').with_value('<SERVICE DEFAULT>')
+        is_expected.to contain_ceilometer_config('service_types/radosgw').with_value('<SERVICE DEFAULT>')
       end
     end
 
@@ -20,6 +21,7 @@ describe 'ceilometer::agent::polling::service_types' do
           :nova    => 'compute',
           :swift   => 'object-store',
           :cinder  => 'volumev3',
+          :radosgw => 'alt-object-store',
         }
       end
 
@@ -29,6 +31,7 @@ describe 'ceilometer::agent::polling::service_types' do
         is_expected.to contain_ceilometer_config('service_types/nova').with_value('compute')
         is_expected.to contain_ceilometer_config('service_types/swift').with_value('object-store')
         is_expected.to contain_ceilometer_config('service_types/cinder').with_value('volumev3')
+        is_expected.to contain_ceilometer_config('service_types/radosgw').with_value('alt-object-store')
       end
     end
   end