summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-08-23 13:37:51 +0000
committerGerrit Code Review <review@openstack.org>2018-08-23 13:37:51 +0000
commitee643b3ccbc070fed7389e5d006aee012f737663 (patch)
tree4c0785a77b7978cfb23bef0d64b00c989011a265
parent3a50a242d34f9ee02bc782629e54710d437b3d23 (diff)
parenta26c2225b656b3c5e057f4b02e17fb70385c40a6 (diff)
Merge "Deprecate send_cluster_metrics"
-rw-r--r--magnum/conf/drivers.py5
-rwxr-xr-xmagnum/service/periodic.py2
-rw-r--r--magnum/tests/unit/service/test_periodic.py8
-rw-r--r--releasenotes/notes/deprecate-send_cluster_metrics-8adaac64a979f720.yaml14
4 files changed, 25 insertions, 4 deletions
diff --git a/magnum/conf/drivers.py b/magnum/conf/drivers.py
index e4e32d9..2006c97 100644
--- a/magnum/conf/drivers.py
+++ b/magnum/conf/drivers.py
@@ -31,7 +31,10 @@ drivers_opts = [
31 help='Path to the OpenStack CA-bundle file to pass and ' 31 help='Path to the OpenStack CA-bundle file to pass and '
32 'install in all cluster nodes.'), 32 'install in all cluster nodes.'),
33 cfg.BoolOpt('send_cluster_metrics', 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 help='Allow periodic tasks to pull COE data and send to ' 38 help='Allow periodic tasks to pull COE data and send to '
36 'ceilometer.'), 39 'ceilometer.'),
37 cfg.ListOpt('disabled_drivers', 40 cfg.ListOpt('disabled_drivers',
diff --git a/magnum/service/periodic.py b/magnum/service/periodic.py
index 2191d02..5e66c77 100755
--- a/magnum/service/periodic.py
+++ b/magnum/service/periodic.py
@@ -16,6 +16,7 @@
16import functools 16import functools
17 17
18from oslo_log import log 18from oslo_log import log
19from oslo_log.versionutils import deprecated
19from oslo_service import loopingcall 20from oslo_service import loopingcall
20from oslo_service import periodic_task 21from oslo_service import periodic_task
21 22
@@ -140,6 +141,7 @@ class MagnumPeriodicTasks(periodic_task.PeriodicTasks):
140 141
141 @periodic_task.periodic_task(run_immediately=True) 142 @periodic_task.periodic_task(run_immediately=True)
142 @set_context 143 @set_context
144 @deprecated(as_of=deprecated.ROCKY)
143 def _send_cluster_metrics(self, ctx): 145 def _send_cluster_metrics(self, ctx):
144 if not CONF.drivers.send_cluster_metrics: 146 if not CONF.drivers.send_cluster_metrics:
145 LOG.debug('Skip sending cluster metrics') 147 LOG.debug('Skip sending cluster metrics')
diff --git a/magnum/tests/unit/service/test_periodic.py b/magnum/tests/unit/service/test_periodic.py
index 416305d..4d50765 100644
--- a/magnum/tests/unit/service/test_periodic.py
+++ b/magnum/tests/unit/service/test_periodic.py
@@ -224,6 +224,7 @@ class PeriodicTestCase(base.TestCase):
224 mock_get_notifier, mock_cluster_list, 224 mock_get_notifier, mock_cluster_list,
225 mock_create_monitor): 225 mock_create_monitor):
226 """Test if RPC notifier receives the expected message""" 226 """Test if RPC notifier receives the expected message"""
227 CONF.set_override('send_cluster_metrics', True, group='drivers')
227 mock_make_admin_context.return_value = self.context 228 mock_make_admin_context.return_value = self.context
228 notifier = mock.MagicMock() 229 notifier = mock.MagicMock()
229 mock_get_notifier.return_value = notifier 230 mock_get_notifier.return_value = notifier
@@ -269,6 +270,7 @@ class PeriodicTestCase(base.TestCase):
269 def test_send_cluster_metrics_compute_metric_raise( 270 def test_send_cluster_metrics_compute_metric_raise(
270 self, mock_make_admin_context, mock_get_notifier, 271 self, mock_make_admin_context, mock_get_notifier,
271 mock_cluster_list, mock_create_monitor): 272 mock_cluster_list, mock_create_monitor):
273 CONF.set_override('send_cluster_metrics', True, group='drivers')
272 mock_make_admin_context.return_value = self.context 274 mock_make_admin_context.return_value = self.context
273 notifier = mock.MagicMock() 275 notifier = mock.MagicMock()
274 mock_get_notifier.return_value = notifier 276 mock_get_notifier.return_value = notifier
@@ -300,6 +302,7 @@ class PeriodicTestCase(base.TestCase):
300 def test_send_cluster_metrics_pull_data_raise( 302 def test_send_cluster_metrics_pull_data_raise(
301 self, mock_make_admin_context, mock_get_notifier, 303 self, mock_make_admin_context, mock_get_notifier,
302 mock_cluster_list, mock_create_monitor): 304 mock_cluster_list, mock_create_monitor):
305 CONF.set_override('send_cluster_metrics', True, group='drivers')
303 mock_make_admin_context.return_value = self.context 306 mock_make_admin_context.return_value = self.context
304 notifier = mock.MagicMock() 307 notifier = mock.MagicMock()
305 mock_get_notifier.return_value = notifier 308 mock_get_notifier.return_value = notifier
@@ -321,6 +324,7 @@ class PeriodicTestCase(base.TestCase):
321 def test_send_cluster_metrics_monitor_none( 324 def test_send_cluster_metrics_monitor_none(
322 self, mock_make_admin_context, mock_get_notifier, 325 self, mock_make_admin_context, mock_get_notifier,
323 mock_cluster_list, mock_create_monitor): 326 mock_cluster_list, mock_create_monitor):
327 CONF.set_override('send_cluster_metrics', True, group='drivers')
324 mock_make_admin_context.return_value = self.context 328 mock_make_admin_context.return_value = self.context
325 notifier = mock.MagicMock() 329 notifier = mock.MagicMock()
326 mock_get_notifier.return_value = notifier 330 mock_get_notifier.return_value = notifier
@@ -340,6 +344,7 @@ class PeriodicTestCase(base.TestCase):
340 def test_send_cluster_metrics_disable_pull_data( 344 def test_send_cluster_metrics_disable_pull_data(
341 self, mock_make_admin_context, mock_get_notifier, 345 self, mock_make_admin_context, mock_get_notifier,
342 mock_cluster_list, mock_create_monitor): 346 mock_cluster_list, mock_create_monitor):
347
343 mock_make_admin_context.return_value = self.context 348 mock_make_admin_context.return_value = self.context
344 notifier = mock.MagicMock() 349 notifier = mock.MagicMock()
345 mock_get_notifier.return_value = notifier 350 mock_get_notifier.return_value = notifier
@@ -352,9 +357,6 @@ class PeriodicTestCase(base.TestCase):
352 monitor.get_metric_unit.return_value = '%' 357 monitor.get_metric_unit.return_value = '%'
353 mock_create_monitor.return_value = monitor 358 mock_create_monitor.return_value = monitor
354 359
355 CONF.set_override('send_cluster_metrics',
356 False, group='drivers')
357
358 periodic.MagnumPeriodicTasks(CONF)._send_cluster_metrics(self.context) 360 periodic.MagnumPeriodicTasks(CONF)._send_cluster_metrics(self.context)
359 361
360 self.assertEqual(0, mock_create_monitor.call_count) 362 self.assertEqual(0, mock_create_monitor.call_count)
diff --git a/releasenotes/notes/deprecate-send_cluster_metrics-8adaac64a979f720.yaml b/releasenotes/notes/deprecate-send_cluster_metrics-8adaac64a979f720.yaml
new file mode 100644
index 0000000..247b9f4
--- /dev/null
+++ b/releasenotes/notes/deprecate-send_cluster_metrics-8adaac64a979f720.yaml
@@ -0,0 +1,14 @@
1---
2deprecations:
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