Merge "Add readiness support for StatefulSet resource"
authorMandeep Khinda <Mandeep.Khinda@amdocs.com>
Thu, 23 Aug 2018 14:18:21 +0000 (14:18 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 23 Aug 2018 14:18:21 +0000 (14:18 +0000)
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.")