Add readiness support for StatefulSet resource 43/57943/2
authorDavid, Dana (dd775k) <dd775k@att.com>
Sun, 29 Jul 2018 11:28:52 +0000 (14:28 +0300)
committerDavid, Dana (dd775k) <dd775k@intl.att.com>
Tue, 31 Jul 2018 07:51:01 +0000 (10:51 +0300)
Change-Id: Ia2d68adfc871041e7ff5a5b27685b0b5f3acadcd
Issue-ID: VID-236
Signed-off-by: David, Dana (dd775k) <dd775k@intl.att.com>
kubernetes/readiness/docker/init/ready.py

index 6d2edef..f4a5e5d 100644 (file)
@@ -41,7 +41,16 @@ def is_ready(container_name):
             if i.status.container_statuses is None:
                 continue
             for s in i.status.container_statuses:
-                if s.name == container_name:
+                if i.metadata.owner_references[0].kind  == "StatefulSet":
+                    if i.metadata.name == container_name:
+                        ready = s.ready
+                        if not ready:
+                            log.info(container_name + " is not ready.")
+                        else:
+                            log.info(container_name + " is ready!")
+                    else:
+                        continue
+                elif s.name == container_name:
                     ready = s.ready
                     if not ready:
                         log.info(container_name + " is not ready.")