From 14a48ad02660581f76c206a7d06876b0d2270c41 Mon Sep 17 00:00:00 2001 From: Vishnu Kannan Date: Fri, 27 Mar 2015 00:10:50 +0000 Subject: [PATCH] Update pod ip using active container only. --- pkg/kubelet/dockertools/docker.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/dockertools/docker.go b/pkg/kubelet/dockertools/docker.go index ea1390817e1d8..956c3d2ee81e2 100644 --- a/pkg/kubelet/dockertools/docker.go +++ b/pkg/kubelet/dockertools/docker.go @@ -676,8 +676,10 @@ func GetDockerPodStatus(client DockerInterface, manifest api.PodSpec, podFullNam if result.err != nil { return nil, err } + // Add user container information - if dockerContainerName == PodInfraContainerName { + if dockerContainerName == PodInfraContainerName && + result.status.State.Running != nil { // Found network container podStatus.PodIP = result.ip } else { @@ -685,6 +687,9 @@ func GetDockerPodStatus(client DockerInterface, manifest api.PodSpec, podFullNam } } + if podStatus.PodIP == "" { + return nil, ErrNoPodInfraContainerInPod + } if len(statuses) == 0 && podStatus.PodIP == "" { return nil, ErrNoContainersInPod }