Force reapply of platform-integ-apps after deploy rollback

When we have ceph backend configured (platform-integ-apps applied)
with some pod using it, and a platform upgrade is done and then a
rollback, the platform-integ-apps is not configured correctly,
because when it is updated (downgraded) after the 'software deploy
activate-rollback', the platform version is still STX.11, so the
configured monitor IP is wrong, because in STX.11 the floating
address is used [1].

However, after 'software deploy host-rollback' and unlocking, the
conductor manager does not identify any changes to the overrides
in /opt/platform/helm, precisely because no files in this
directory were changed, as the modified overrides were in STX.11.

To solve this issue, the platform-integ-apps lifecycle receives a
downgrade operation, checks if it is a rollback, and then the N-1
version (stx.10) overrides have their contents erased, to ensure
there is a difference between the hash calculations and that the
app's reapply flag is set inside the 'evaluate_apps_reapply'
function.

[1]: https://review.opendev.org/c/starlingx/config/+/954367

Test Plan:
 - PASS: On AIO-SX, upgrade the platform and then rollback.
 - PASS: Check if all pods are running.

Closes-Bug: 2122354

Change-Id: I881a017763d9ac757af86b16c4aa4ad2863d3492
Signed-off-by: Erickson Silva de Oliveira <Erickson.SilvadeOliveira@windriver.com>
This commit is contained in:
Erickson Silva de Oliveira
2025-09-08 11:41:56 -03:00
parent 0032f72692
commit 4ccf16d914

View File

@@ -13,6 +13,7 @@
# pylint: disable=no-name-in-module
import os
import subprocess
from pathlib import Path
from oslo_log import log as logging
from sysinv.common import constants
@@ -68,6 +69,9 @@ class PlatformAppLifecycleOperator(base.AppLifecycleOperator):
elif hook_info.operation == constants.APP_REMOVE_OP and \
hook_info.relative_timing == LifecycleConstants.APP_LIFECYCLE_TIMING_POST:
return lifecycle_utils.delete_local_registry_secrets(app_op, app, hook_info)
elif (hook_info.operation == constants.APP_DOWNGRADE_OP and
hook_info.relative_timing == LifecycleConstants.APP_LIFECYCLE_TIMING_PRE):
return self.pre_downgrade(app, hook_info)
# Use the default behaviour for other hooks
super(PlatformAppLifecycleOperator, self).app_lifecycle_actions(context, conductor_obj, app_op, app, hook_info)
@@ -143,6 +147,32 @@ class PlatformAppLifecycleOperator(base.AppLifecycleOperator):
"""
lifecycle_utils.create_local_registry_secrets(app_op, app, hook_info)
def pre_downgrade(self, app, hook_info):
""" Pre downgrade actions
This function forces a reapply of the app after 'software deploy activate-rollback',
clearing the contents of the N-1 release overrides, so that kube_app can identify
changes in the overrides.
:param app: AppOperator.Application object
:param app_op: AppOperator object
"""
from_app_version = hook_info.extra.get("from_app_version")
to_app_version = hook_info.extra.get("to_app_version")
from_release = from_app_version.split("-")[0]
to_release = to_app_version.split("-")[0]
if from_release != to_release:
overrides_path = Path(os.path.join(constants.PLATFORM_PATH,
"helm",
to_release,
app.name,
to_app_version))
if os.path.isdir(overrides_path):
for override_path in overrides_path.glob("*.yaml"):
override_path.write_text("")
def delete_csi_drivers(self, app):
""" Delete CSI drivers