Notify dcmanager when k8s upgrade completes

When a k8s upgrade has been completed, we notify dcmanager so that
it can do a kubernetes audit of the subclouds immediately rather
than waiting up to an hour for the normal audit to run.

Change-Id: Ife2abdbc65ad4ee91441db8fa39cb80291cbe201
Signed-off-by: Jessica Castelino <jessica.castelino@windriver.com>
Partial-Bug: 1928864
This commit is contained in:
Jessica Castelino 2021-05-18 16:02:29 -04:00
parent 1399a4bc54
commit 32b4df542c
2 changed files with 12 additions and 0 deletions

View File

@ -21,6 +21,7 @@ from sysinv.api.controllers.v1 import link
from sysinv.api.controllers.v1 import patch_api
from sysinv.api.controllers.v1 import types
from sysinv.common import constants
from sysinv.common import dc_api
from sysinv.common import exception
from sysinv.common import kubernetes
from sysinv.common import utils as cutils
@ -382,6 +383,12 @@ class KubeUpgradeController(rest.RestController):
LOG.info("Completed kubernetes upgrade to version: %s" %
kube_upgrade_obj.to_version)
# If applicable, notify dcmanager upgrade is complete
system = pecan.request.dbapi.isystem_get_one()
role = system.get('distributed_cloud_role')
if role == constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER:
dc_api.notify_dcmanager_kubernetes_upgrade_completed()
return KubeUpgrade.convert_with_links(kube_upgrade_obj)
else:

View File

@ -41,3 +41,8 @@ def notify_dcmanager(events):
def notify_dcmanager_platform_upgrade_completed():
"""Send the platform-upgrade-completed event to dcmanager."""
notify_dcmanager([DC_EVENT_PLATFORM_UPGRADE_COMPLETED])
def notify_dcmanager_kubernetes_upgrade_completed():
"""Send the k8s-upgrade-completed event to dcmanager."""
notify_dcmanager([DC_EVENT_K8S_UPGRADE_COMPLETED])