Skip to content

Commit

Permalink
Always return an IP address (#2065)
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf authored Feb 11, 2018
1 parent 42c7111 commit d4784cf
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions internal/k8s/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,29 @@ func GetNodeIPOrName(kubeClient clientset.Interface, name string, useInternalIP
return ""
}

if useInternalIP {
for _, address := range node.Status.Addresses {
if address.Type == apiv1.NodeInternalIP {
if address.Address != "" {
return address.Address
}
ip := ""

for _, address := range node.Status.Addresses {
if address.Type == apiv1.NodeExternalIP {
if address.Address != "" {
ip = address.Address
break
}
}
} else {
}

if useInternalIP {
for _, address := range node.Status.Addresses {
if address.Type == apiv1.NodeExternalIP {
if address.Type == apiv1.NodeInternalIP {
if address.Address != "" {
return address.Address
ip = address.Address
break
}
}
}
}

return ""
return ip
}

// PodInfo contains runtime information about the pod running the Ingres controller
Expand Down

0 comments on commit d4784cf

Please sign in to comment.