From fdeaece6d572c0d0c9d19070aac5bec2c08f4621 Mon Sep 17 00:00:00 2001 From: Marcelo de Castro Loebens Date: Fri, 7 Nov 2025 15:31:09 -0400 Subject: [PATCH] Create k8s port change flag on rollback On the stx 11 side, some of sysinv code is executed conditionally to handle the kube-apiserver port change that was done in the upgrade from stx 10. This code is not compatible with a rollback from stx 12, causing sysinv to use the legacy kube-apiserver port when trying to do a kube-apiserver health check, resulting in an alarm while the the rollback isn't done. To avoid this, this change includes the creation of the mentioned flag when a rollback is performed, making sysinv use the correct port. Test plan: PASS: Upgrade AIO-SX from stx 11 to stx 12. PASS: Rollback AIO-SX (before activation) from stx 12 to stx 11. Closes-bug: 2130905 Change-Id: I4082deea06769bb3215c6071f0ddb263095561ac Signed-off-by: Marcelo de Castro Loebens --- software/software/agent_hooks.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/software/software/agent_hooks.py b/software/software/agent_hooks.py index 826b02eec..583b5b487 100644 --- a/software/software/agent_hooks.py +++ b/software/software/agent_hooks.py @@ -507,6 +507,22 @@ class CreateUSMUpgradeInProgressFlag(BaseHook): LOG.info("Created %s flag" % flag_file) +# TODO(mdecastr): Only required in stx 12. Remove in future releases. +class CreateKubeApiserverPortUpdatedFlag(BaseHook): + def __init__(self, attrs): + super().__init__(attrs) + self.KUBE_APISERVER_PORT_UPDATED_FLAG = \ + os.path.join(BaseHook.PLATFORM_CONF_PATH, ".upgrade_kube_apiserver_port_updated") + + def run(self): + if (self._to_release == '25.09' and + self.get_platform_conf("nodetype") == self.CONTROLLER): + flag_file = "%s/%s" % (self.TO_RELEASE_OSTREE_DIR, + self.KUBE_APISERVER_PORT_UPDATED_FLAG) + with open(flag_file, "w") as _: + LOG.info("Created %s flag" % flag_file) + + class RestartKubeApiServer(BaseHook): """ Restart the kube-apiserver after the host rollback/upgrade to @@ -1368,6 +1384,7 @@ class HookManager(object): RevertCrtPermissionsHook, LogPermissionRestorerHook, CISSysctlFlagHookRollback, + CreateKubeApiserverPortUpdatedFlag, # enable usm-initialize service for next # reboot only if everything else is done UsmInitHook,