Add Armada pod ready check in sysinv application audit
In rare cases, after controller-0 is up from the initial unlock, armada pod is not running and ready yet when uploading platform-integ-apps. This will cause application upload failed. For the sysinv managed applications, update to ensure Armada pod is running and ready before attempting to upload/apply applications. Change-Id: I176bd1bbdb2ecf6285bd680091812aac43ea0ae3 Closes-Bug: 1912520 Signed-off-by: Angie Wang <angie.wang@windriver.com>
This commit is contained in:
parent
ad9474c5ff
commit
f2dbdddcd1
|
@ -2996,7 +2996,7 @@ class ArmadaHelper(object):
|
|||
return False
|
||||
return True
|
||||
|
||||
def _check_pod_ready_probe(self, pod):
|
||||
def check_pod_ready_probe(self, pod):
|
||||
"""Pod is of the form returned by self._kube.kube_get_pods_by_selector.
|
||||
Returns true if last probe shows the container is in 'Ready' state.
|
||||
"""
|
||||
|
@ -3012,7 +3012,7 @@ class ArmadaHelper(object):
|
|||
for pod in pods:
|
||||
if pod.status.phase == 'Running' and \
|
||||
pod.metadata.deletion_timestamp is None and \
|
||||
self._check_pod_ready_probe(pod):
|
||||
self.check_pod_ready_probe(pod):
|
||||
return pod
|
||||
return pods[0]
|
||||
|
||||
|
@ -3072,7 +3072,7 @@ class ArmadaHelper(object):
|
|||
ARMADA_NAMESPACE, pod.metadata.name)
|
||||
|
||||
if pod and pod.status.phase == 'Running' and \
|
||||
self._check_pod_ready_probe(pod):
|
||||
self.check_pod_ready_probe(pod):
|
||||
# Test that we can copy files into armada-api container
|
||||
src = '/etc/build.info'
|
||||
dest_dir = '{}:{}'.format(pod.metadata.name, '/tmp')
|
||||
|
|
|
@ -248,6 +248,7 @@ class ConductorManager(service.PeriodicService):
|
|||
self._app = kube_app.AppOperator(self.dbapi, self._helm)
|
||||
self._docker = kube_app.DockerHelper(self.dbapi)
|
||||
self._kube = kubernetes.KubeOperator()
|
||||
self._armada = kube_app.ArmadaHelper(self._kube)
|
||||
self._kube_app_helper = kube_api.KubeAppHelper(self.dbapi)
|
||||
self._fernet = fernet.FernetOperator()
|
||||
|
||||
|
@ -5499,12 +5500,16 @@ class ConductorManager(service.PeriodicService):
|
|||
"activity")
|
||||
return
|
||||
|
||||
# Ensure that armada pod is running.
|
||||
# Ensure that armada pod is running and ready.
|
||||
pods = self._kube.kube_get_pods_by_selector("armada",
|
||||
"application=armada",
|
||||
"status.phase=Running")
|
||||
if not pods:
|
||||
LOG.warning("armada pod not present")
|
||||
for pod in pods:
|
||||
if (pod.metadata.deletion_timestamp is None and
|
||||
self._armada.check_pod_ready_probe(pod)):
|
||||
break
|
||||
else:
|
||||
LOG.warning("Armada pod is not running and ready. Defer audit.")
|
||||
return
|
||||
|
||||
# Defer platform managed application activity while an upgrade is active
|
||||
|
|
Loading…
Reference in New Issue