Run k8s health audit after upgrade/rollback

Make a rpc call to conductor to run the audit for
kubernetes health manually.

This will be used to refresh the alarm that can be raised
during upgrade activation or rollback, when kube-apiserver
is being reconfigured, if the periodic audit is executed
at the same time.

Extra: Fix linter error, newline missing at the end of the
       file patch-scripts/start-scripts/24.09.300/pre-start.sh

Test plan:
PASS: Upgrade activation - stx10->11 - AIO-SX* and AIO-DX
PASS: Upgrade activation rollback - stx11->10 - AIO-SX* and AIO-DX

Story: 2011399
Task: 52618

Depends-on: https://review.opendev.org/c/starlingx/config/+/956367

Change-Id: Ib822831c843984040994ba82e27a3222b23ab33d
Signed-off-by: Marcelo de Castro Loebens <Marcelo.DeCastroLoebens@windriver.com>
This commit is contained in:
Marcelo de Castro Loebens
2025-08-01 09:26:24 -04:00
parent 25923e0c4e
commit d59d23c5c3
2 changed files with 10 additions and 0 deletions

View File

@@ -104,3 +104,4 @@ else
fi
echo "### End of pre-start script ###"

View File

@@ -125,6 +125,13 @@ def create_kube_apiserver_port_rollback_flag_rpc():
rpcapi.flag_k8s_port_update_rollback(context)
def run_kubernetes_health_audit_rpc():
CONF.rpc_zeromq_conductor_bind_ip = get_conductor_rpc_bind_ip()
context = mycontext.get_admin_context()
rpcapi = conductor_rpcapi.ConductorAPI(topic=conductor_rpcapi.MANAGER_TOPIC)
rpcapi.run_kubernetes_health_audit(context)
def wait_kube_apiserver_port_update(desired_status):
LOG.info("Wait kube-apiserver port update finish.")
retries = 60
@@ -205,6 +212,7 @@ def main():
LOG.error("K8s is unhealthy, aborting. "
"Please check logs.")
return ERROR
run_kubernetes_health_audit_rpc()
elif action == "activate-rollback" and to_release == "24.09":
if check_kube_apiserver_port_updated():
create_kube_apiserver_port_rollback_flag_rpc()
@@ -219,6 +227,7 @@ def main():
LOG.error("K8s is unhealthy, aborting. "
"Please check logs.")
return ERROR
run_kubernetes_health_audit_rpc()
else:
LOG.info("Nothing to do. "
"Skipping K8s service parameter apply.")