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 <Marcelo.DeCastroLoebens@windriver.com>
This commit is contained in:
Marcelo de Castro Loebens
2025-11-10 11:34:33 -04:00
parent dae2c57b08
commit fdeaece6d5
+17
View File
@@ -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,