Delete deprecated chart during app update

After the OSH-I upversion [1], a new Ingress chart was
introduced to STX-O application [2]. This resulted in 2
different Ingress Controllers running when trying a live
upgrade of the app.

This review aims to have the lifecycle plugin deleting the
deprecated Ingress release during an app update.

[1] - https://review.opendev.org/c/starlingx/openstack-armada-app/+/939081
[2] - https://review.opendev.org/c/starlingx/openstack-armada-app/+/939376

Test Plan:
PASS - Build python3-k8sapp-openstack package
PASS - Build StarlingX Openstack tarball
PASS - Run system application-update with the new tarball
PASS - Deprecated Ingress deleted during update

Story: 2011262
task: 51657

Change-Id: I2e3a9d2278512d88e9e66c62020add9afa095bbd
Signed-off-by: Daniel Caires <DanielMarques.Caires@windriver.com>
This commit is contained in:
Daniel Caires 2025-02-10 09:20:35 -03:00 committed by Murillo Arantes
parent 203650b90c
commit 5be7610875

View File

@ -17,6 +17,7 @@ from sysinv.common import exception
from sysinv.helm import common
from sysinv.helm import lifecycle_base as base
from sysinv.helm import lifecycle_utils as lifecycle_utils
from sysinv.helm import utils as helm_utils
from sysinv.helm.lifecycle_constants import LifecycleConstants
from k8sapp_openstack import utils as app_utils
@ -85,6 +86,10 @@ class OpenstackAppLifecycleOperator(base.AppLifecycleOperator):
hook_info.operation == constants.APP_APPLY_OP and \
hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE:
return self._pre_manual_apply_check(conductor_obj, app, hook_info)
elif hook_info.mode == constants.APP_LIFECYCLE_MODE_MANUAL and \
hook_info.operation == constants.APP_UPDATE_OP and \
hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE:
return self._pre_update_cleanup_actions(hook_info)
# Default behavior
super(OpenstackAppLifecycleOperator, self).app_lifecycle_actions(context, conductor_obj, app_op, app,
@ -407,3 +412,12 @@ class OpenstackAppLifecycleOperator(base.AppLifecycleOperator):
)
if group_exists:
ldap.delete_group(app_constants.CLIENTS_WORKING_DIR_GROUP)
def _pre_update_cleanup_actions(self, hook_info):
"""Perform pre update cleanup actions."""
# TODO: Remove in the future. This code is only necessary when
# updating from stx-10 to stx-11 STX-O release.
status = helm_utils.delete_helm_release(
release='osh-openstack-ingress', namespace=app_constants.HELM_NS_OPENSTACK)
LOG.info(status)