[k8s] Support configurable health polling interval

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 8e9df14d27)
(cherry picked from commit dbe461c16b)
This commit is contained in:
Feilong Wang 2020-05-16 12:01:28 +12:00 committed by Bharat Kunwar
parent 8aefee199f
commit 02e47978d7
3 changed files with 21 additions and 1 deletions

View File

@ -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.')),
]

View File

@ -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:

View File

@ -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.