aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordfx1971 <avi.ziv@amdocs.com>2020-01-16 09:55:27 +0200
committerdfx1971 <avi.ziv@amdocs.com>2020-01-16 12:46:07 +0200
commit5d3e392fdf1f87b49c8b9df31324c61e88152716 (patch)
tree1285af435631b1106a6a226b27eb575464cdac6e
parent3a8cff593c057e7f1dbb5b94657cf71277776e5b (diff)
OOM-2261 readiness-check does not track DaemonSet
Issue-ID: OOM-2261 Signed-off-by: Avi Ziv<avi.ziv@amdocs.com> Change-Id: I7f220f8b6b64165c33ed8d707834091240136199 Signed-off-by: Avi Ziv<avi.ziv@amdocs.com> Change-Id: I7f220f8b6b64165c33ed8d707834091240136199
-rw-r--r--kubernetes/readiness/src/main/scripts/ready.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/kubernetes/readiness/src/main/scripts/ready.py b/kubernetes/readiness/src/main/scripts/ready.py
index 3f76d10395..93932073cd 100644
--- a/kubernetes/readiness/src/main/scripts/ready.py
+++ b/kubernetes/readiness/src/main/scripts/ready.py
@@ -92,6 +92,20 @@ def wait_for_deployment_complete(deployment_name):
log.error("Exception when waiting for deployment status: %s\n" % e)
+def wait_for_daemonset_complete(daemonset_name):
+ try:
+ response = api_instance.read_namespaced_daemon_set(daemonset_name, namespace)
+ s = response.status
+ if s.desired_number_scheduled == s.number_ready:
+ log.info("DaemonSet: " + str(s.number_ready) + "/" + str(s.desired_number_scheduled) + " nodes ready --> " + daemonset_name + " is ready")
+ return True
+ else:
+ log.info("DaemonSet: " + str(s.number_ready) + "/" + str(s.desired_number_scheduled) + " nodes ready --> " + daemonset_name + " is not ready")
+ return False
+ except Exception as e:
+ log.error("Exception when waiting for DaemonSet status: %s\n" % e)
+
+
def is_ready(container_name):
ready = False
log.info("Checking if " + container_name + " is ready")
@@ -112,6 +126,8 @@ def is_ready(container_name):
ready = wait_for_deployment_complete(deployment_name)
elif i.metadata.owner_references[0].kind == "Job":
ready = is_job_complete(name)
+ elif i.metadata.owner_references[0].kind == "DaemonSet":
+ ready = wait_for_daemonset_complete(i.metadata.owner_references[0].name)
return ready
@@ -123,7 +139,7 @@ def is_ready(container_name):
def read_name(item):
- return item.metadata.owner_reference[0].name
+ return item.metadata.owner_references[0].name
def get_deployment_name(replicaset):