From a0494d594263c34f87406ef8c0cbec2f56a95be6 Mon Sep 17 00:00:00 2001 From: Feilong Wang Date: Sat, 16 May 2020 12:01:28 +1200 Subject: [PATCH] [cern][k8s] Support configurable health polling interval upstream https://review.opendev.org/#/c/728775/ The default 10 seconds health polling interval is too frequent for most of the cases. Now it has been changed to 60s. A new config `health_polling_interval` is added to make the interval configurable. Cloud admin can totally disable the health polling by set a negative value for the config. Task: 39795 Story: 2007683 Change-Id: Iad30487b8c119e94ee21d75f53fb86eb23dff365 (cherry picked from commit 8e9df14d2773a16c21d2c7c52e3e9d40dd0f84df) --- magnum/conf/kubernetes.py | 5 +++++ magnum/service/periodic.py | 4 +++- ...8s-health-polling-interval-75bb83b4701d48c5.yaml | 13 +++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/configurable-k8s-health-polling-interval-75bb83b4701d48c5.yaml diff --git a/magnum/conf/kubernetes.py b/magnum/conf/kubernetes.py index 2de9370e2..a2502777b 100644 --- a/magnum/conf/kubernetes.py +++ b/magnum/conf/kubernetes.py @@ -22,6 +22,11 @@ kubernetes_opts = [ 'Keystone auth policy for Kubernetes cluster when ' 'the Keystone auth is enabled. Vendors can put their ' 'specific default policy here'), + cfg.IntOpt('health_polling_interval', + default=60, + help=('The default polling interval for Kubernetes cluster ' + 'health. If this number is negative the periodic task ' + 'will be disabled.')), ] diff --git a/magnum/service/periodic.py b/magnum/service/periodic.py index d7f68a217..1bf91c133 100755 --- a/magnum/service/periodic.py +++ b/magnum/service/periodic.py @@ -152,7 +152,9 @@ class MagnumPeriodicTasks(periodic_task.PeriodicTasks): super(MagnumPeriodicTasks, self).__init__(conf) self.notifier = rpc.get_notifier() - @periodic_task.periodic_task(spacing=10, run_immediately=True) + @periodic_task.periodic_task( + spacing=CONF.kubernetes.health_polling_interval, + run_immediately=True) @set_context def sync_cluster_status(self, ctx): try: diff --git a/releasenotes/notes/configurable-k8s-health-polling-interval-75bb83b4701d48c5.yaml b/releasenotes/notes/configurable-k8s-health-polling-interval-75bb83b4701d48c5.yaml new file mode 100644 index 000000000..b5e2666b6 --- /dev/null +++ b/releasenotes/notes/configurable-k8s-health-polling-interval-75bb83b4701d48c5.yaml @@ -0,0 +1,13 @@ +--- +features: + - | + The default 10 seconds health polling interval is too frequent for most of + the cases. Now it has been changed to 60s. A new config + `health_polling_interval` is supported to make the interval configurable. + Cloud admin can totally disable the health polling by set a negative value + for the config. +upgrade: + - | + If it's still preferred to have 10s health polling interval for Kubernetes + cluster. It can be set by config `health_polling_interval` under + `kubernetes` section. \ No newline at end of file -- GitLab