Skip to content

Commit

Permalink
Merge pull request #2658 from /issues/2632-use-pod-status
Browse files Browse the repository at this point in the history
Make NPC only look at IP addresses on running pods
  • Loading branch information
awh committed Nov 22, 2016
2 parents e7bde18 + 4219c2c commit a6edd40
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions npc/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,9 @@ func (ns *ns) deleteNamespace(obj *coreapi.Namespace) error {
}

func hasIP(pod *coreapi.Pod) bool {
// Ensure pod has an IP address and isn't sharing the host network namespace
return len(pod.Status.PodIP) > 0 && !pod.Spec.HostNetwork
// Ensure pod isn't dead, has an IP address and isn't sharing the host network namespace
return pod.Status.Phase != "Succeeded" && pod.Status.Phase != "Failed" &&
len(pod.Status.PodIP) > 0 && !pod.Spec.HostNetwork
}

func equals(a, b map[string]string) bool {
Expand Down

0 comments on commit a6edd40

Please sign in to comment.