From 20baa2ee9d4a6fa0a9c25eec8dac19599460022c Mon Sep 17 00:00:00 2001 From: Soam Vasani Date: Wed, 25 Jan 2017 15:32:34 -0800 Subject: [PATCH] Wait for Pod IP while waiting for pod ready (#89) Addresses issue #88. --- poolmgr/gp.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/poolmgr/gp.go b/poolmgr/gp.go index 946fb28a..d7a46faf 100644 --- a/poolmgr/gp.go +++ b/poolmgr/gp.go @@ -173,10 +173,18 @@ func (gp *GenericPool) _choosePod(newLabels map[string]string) (*v1.Pod, error) } readyPods := make([]*v1.Pod, 0, len(podList.Items)) for _, pod := range podList.Items { + // If a pod has no IP it's not ready + if len(pod.Status.PodIP) == 0 { + continue + } + + // Wait for all containers in the pod to be ready podReady := true for _, cs := range pod.Status.ContainerStatuses { podReady = podReady && cs.Ready } + + // add it to the list of ready pods if podReady { readyPods = append(readyPods, &pod) }