Browse Source

Deprecate send_cluster_metrics

Currently, Magnum is running periodic tasks to collect k8s cluster
metrics to message bus. Unfortunately, it's collecting pods info
only from "default" namespace which makes this function useless.
What's more, even Magnum can get all pods from all namespaces, it
doesn't make much sense to keep this function in Magnum. Because
operators only care about the health of cluster nodes. If they
want to know the status of pods, they can use heapster or other
tools to get that.

Task: 22619
Story: 1775116

Change-Id: I3ca0f2e96fe63870406cc5323f08fa018ac6e8be
(cherry picked from commit a26c2225b6)
tags/7.0.1^0
Feilong Wang 11 months ago
parent
commit
0dbe6806ed

+ 4
- 1
magnum/conf/drivers.py View File

@@ -31,7 +31,10 @@ drivers_opts = [
31 31
                help='Path to the OpenStack CA-bundle file to pass and '
32 32
                     'install in all cluster nodes.'),
33 33
     cfg.BoolOpt('send_cluster_metrics',
34
-                default=True,
34
+                default=False,
35
+                deprecated_for_removal=True,
36
+                deprecated_reason='It does not make sense only collecting '
37
+                                  'metrics from the "default" namespcae.',
35 38
                 help='Allow periodic tasks to pull COE data and send to '
36 39
                      'ceilometer.'),
37 40
     cfg.ListOpt('disabled_drivers',

+ 2
- 0
magnum/service/periodic.py View File

@@ -16,6 +16,7 @@
16 16
 import functools
17 17
 
18 18
 from oslo_log import log
19
+from oslo_log.versionutils import deprecated
19 20
 from oslo_service import loopingcall
20 21
 from oslo_service import periodic_task
21 22
 
@@ -140,6 +141,7 @@ class MagnumPeriodicTasks(periodic_task.PeriodicTasks):
140 141
 
141 142
     @periodic_task.periodic_task(run_immediately=True)
142 143
     @set_context
144
+    @deprecated(as_of=deprecated.ROCKY)
143 145
     def _send_cluster_metrics(self, ctx):
144 146
         if not CONF.drivers.send_cluster_metrics:
145 147
             LOG.debug('Skip sending cluster metrics')

+ 5
- 3
magnum/tests/unit/service/test_periodic.py View File

@@ -224,6 +224,7 @@ class PeriodicTestCase(base.TestCase):
224 224
                                   mock_get_notifier, mock_cluster_list,
225 225
                                   mock_create_monitor):
226 226
         """Test if RPC notifier receives the expected message"""
227
+        CONF.set_override('send_cluster_metrics', True, group='drivers')
227 228
         mock_make_admin_context.return_value = self.context
228 229
         notifier = mock.MagicMock()
229 230
         mock_get_notifier.return_value = notifier
@@ -269,6 +270,7 @@ class PeriodicTestCase(base.TestCase):
269 270
     def test_send_cluster_metrics_compute_metric_raise(
270 271
             self, mock_make_admin_context, mock_get_notifier,
271 272
             mock_cluster_list, mock_create_monitor):
273
+        CONF.set_override('send_cluster_metrics', True, group='drivers')
272 274
         mock_make_admin_context.return_value = self.context
273 275
         notifier = mock.MagicMock()
274 276
         mock_get_notifier.return_value = notifier
@@ -300,6 +302,7 @@ class PeriodicTestCase(base.TestCase):
300 302
     def test_send_cluster_metrics_pull_data_raise(
301 303
             self, mock_make_admin_context, mock_get_notifier,
302 304
             mock_cluster_list, mock_create_monitor):
305
+        CONF.set_override('send_cluster_metrics', True, group='drivers')
303 306
         mock_make_admin_context.return_value = self.context
304 307
         notifier = mock.MagicMock()
305 308
         mock_get_notifier.return_value = notifier
@@ -321,6 +324,7 @@ class PeriodicTestCase(base.TestCase):
321 324
     def test_send_cluster_metrics_monitor_none(
322 325
             self, mock_make_admin_context, mock_get_notifier,
323 326
             mock_cluster_list, mock_create_monitor):
327
+        CONF.set_override('send_cluster_metrics', True, group='drivers')
324 328
         mock_make_admin_context.return_value = self.context
325 329
         notifier = mock.MagicMock()
326 330
         mock_get_notifier.return_value = notifier
@@ -340,6 +344,7 @@ class PeriodicTestCase(base.TestCase):
340 344
     def test_send_cluster_metrics_disable_pull_data(
341 345
             self, mock_make_admin_context, mock_get_notifier,
342 346
             mock_cluster_list, mock_create_monitor):
347
+
343 348
         mock_make_admin_context.return_value = self.context
344 349
         notifier = mock.MagicMock()
345 350
         mock_get_notifier.return_value = notifier
@@ -352,9 +357,6 @@ class PeriodicTestCase(base.TestCase):
352 357
         monitor.get_metric_unit.return_value = '%'
353 358
         mock_create_monitor.return_value = monitor
354 359
 
355
-        CONF.set_override('send_cluster_metrics',
356
-                          False, group='drivers')
357
-
358 360
         periodic.MagnumPeriodicTasks(CONF)._send_cluster_metrics(self.context)
359 361
 
360 362
         self.assertEqual(0, mock_create_monitor.call_count)

+ 14
- 0
releasenotes/notes/deprecate-send_cluster_metrics-8adaac64a979f720.yaml View File

@@ -0,0 +1,14 @@
1
+---
2
+deprecations:
3
+  - |
4
+    Currently, Magnum is running periodic tasks to collect k8s cluster
5
+    metrics to message bus. Unfortunately, it's collecting pods info
6
+    only from "default" namespace which makes this function useless.
7
+    What's more, even Magnum can get all pods from all namespaces, it
8
+    doesn't make much sense to keep this function in Magnum. Because
9
+    operators only care about the health of cluster nodes. If they
10
+    want to know the status of pods, they can use heapster or other
11
+    tools to get that. So the feauture is being deprecated now and will be
12
+    removed in Stein release. And the default value is changed to False, which
13
+    means won't send the metrics.
14
+

Loading…
Cancel
Save