Add ingress update during upgrade recovery
It was found that after disabling the ingress reconciliation during the update process, if for any reason the update fails the old Ingress will not come back when the suspend flag is 'True' in the Ingress Helmrelease. This review aims to add an update step during the application recovery, that will reactivate the Helmrelease reconciliation. Test Plan: PASS - Build python3-k8sapp-openstack package PASS - Build STX-Openstack tarball PASS - Run system application-update and force fail it PASS - Update recovery is triggered PASS - Full recovery to 24.09 Story: 2011262 Task: 51285 Change-Id: Ic390c81e65eaf40989318f4f91c75539a7a7295a Signed-off-by: Daniel Caires <DanielMarques.Caires@windriver.com>
This commit is contained in:
parent
f205fa6d3e
commit
f3b1a2aed1
@ -64,6 +64,8 @@ class OpenstackAppLifecycleOperator(base.AppLifecycleOperator):
|
||||
elif hook_info.operation == constants.APP_REMOVE_OP and \
|
||||
hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_POST:
|
||||
return self._delete_app_specific_resources_post_remove(app_op, app, hook_info)
|
||||
elif hook_info.operation == constants.APP_RECOVER_OP:
|
||||
return self._recover_app_resources_failed_update()
|
||||
|
||||
# Rbd
|
||||
elif hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_RBD:
|
||||
@ -430,3 +432,24 @@ class OpenstackAppLifecycleOperator(base.AppLifecycleOperator):
|
||||
status = helm_utils.delete_helm_release(
|
||||
release='osh-openstack-ingress', namespace=app_constants.HELM_NS_OPENSTACK)
|
||||
LOG.info(status)
|
||||
|
||||
def _recover_app_resources_failed_update(self):
|
||||
""" Perform resource recover after failed update"""
|
||||
|
||||
# TODO: Remove in the future. This code is only necessary when
|
||||
# updating from stx-10 to stx-11 STX-O release.
|
||||
release = 'ingress'
|
||||
patch = {"spec": {"suspend": False}}
|
||||
|
||||
# Update helmrelease to revert changes
|
||||
app_utils.update_helmrelease(release, patch)
|
||||
|
||||
# The new Ingress must be disabled and deleted before starting recovery
|
||||
release_failed = 'ingress-nginx-openstack'
|
||||
patch_failed = {"spec": {"suspend": True}}
|
||||
app_utils.update_helmrelease(release_failed, patch_failed)
|
||||
|
||||
# Uninstall helm release.
|
||||
status = helm_utils.delete_helm_release(
|
||||
release=release_failed, namespace=app_constants.HELM_NS_OPENSTACK)
|
||||
LOG.info(status)
|
||||
|
Loading…
x
Reference in New Issue
Block a user