Commit 3090d041 authored by Sagar Arora's avatar Sagar Arora

fix(ci): waiting for a pod using k8s wait command

Signed-off-by: default avatarSagar Arora <sagar.arora@openairinterface.org>
parent d999ed2b
...@@ -208,7 +208,7 @@ class Cluster: ...@@ -208,7 +208,7 @@ class Cluster:
return -1 return -1
return int(result.group("size")) return int(result.group("size"))
def _deploy_pod(self, filename, timeout = 30): def _deploy_pod(self, filename, timeout = 120):
ret = self.cmd.run(f'oc create -f {filename}') ret = self.cmd.run(f'oc create -f {filename}')
result = re.search(f'pod/(?P<pod>[a-zA-Z0-9_\-]+) created', ret.stdout) result = re.search(f'pod/(?P<pod>[a-zA-Z0-9_\-]+) created', ret.stdout)
if result is None: if result is None:
...@@ -216,11 +216,9 @@ class Cluster: ...@@ -216,11 +216,9 @@ class Cluster:
return None return None
pod = result.group("pod") pod = result.group("pod")
logging.debug(f'checking if pod {pod} is in Running state') logging.debug(f'checking if pod {pod} is in Running state')
while timeout > 0: ret = self.cmd.run(f'oc wait --for=condition=ready pod {pod} --timeout={timeout}s', silent=True)
ret = self.cmd.run(f'oc get pod {pod} -o json | jq -Mc .status.phase', silent=True) if ret.returncode == 0:
if re.search('"Running"', ret.stdout) is not None: return pod return pod
timeout -= 1
time.sleep(1)
logging.error(f'pod {pod} did not reach Running state') logging.error(f'pod {pod} did not reach Running state')
self._undeploy_pod(filename) self._undeploy_pod(filename)
return None return None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment