summaryrefslogtreecommitdiffstats
path: root/kubernetes/readiness
diff options
context:
space:
mode:
authorBorislavG <Borislav.Glozman@amdocs.com>2018-02-14 15:23:51 +0200
committerBorislavG <Borislav.Glozman@amdocs.com>2018-02-14 15:26:13 +0200
commit07dc7db266ecfb88a783a94fac5c54e2092bda53 (patch)
tree6068461f3e556fd809eaa8f308787a028f1918a0 /kubernetes/readiness
parent58ba9e800fdd7024f43a3e5195dc5275ce3d5b7e (diff)
Fix readiness-check exception
The problem is that the script tried to iterate on statuses of pod containers. when some pod is in state "pending" or some other case when there is no status, the statuses is None. Therefore python throws exception when trying to iterate None, which is non-iterable. Issue-ID: OOM-514 Signed-off-by: BorislavG <Borislav.Glozman@amdocs.com> Change-Id: If57b8a632a83489fddb12373e4047396f5fa08a3
Diffstat (limited to 'kubernetes/readiness')
-rw-r--r--kubernetes/readiness/docker/init/ready.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/kubernetes/readiness/docker/init/ready.py b/kubernetes/readiness/docker/init/ready.py
index c5b55eef18..7cfb6cdcde 100644
--- a/kubernetes/readiness/docker/init/ready.py
+++ b/kubernetes/readiness/docker/init/ready.py
@@ -36,6 +36,9 @@ def is_ready(container_name):
try:
response = v1.list_namespaced_pod(namespace=namespace, watch=False)
for i in response.items:
+ # container_statuses can be None, which is non-iterable.
+ if i.status.container_statuses is None:
+ continue
for s in i.status.container_statuses:
if s.name == container_name:
ready = s.ready