Refactor update of status removing initial check for loadbalancer

This commit is contained in:
Manuel de Brito Fontes 2018-05-13 09:38:30 -04:00
parent e82cb31275
commit 55051743fd
3 changed files with 15 additions and 37 deletions

View file

@ -45,29 +45,25 @@ func GetNodeIPOrName(kubeClient clientset.Interface, name string, useInternalIP
return ""
}
ip := ""
for _, address := range node.Status.Addresses {
if address.Type == apiv1.NodeExternalIP {
if address.Address != "" {
ip = address.Address
break
}
}
}
if useInternalIP {
for _, address := range node.Status.Addresses {
if address.Type == apiv1.NodeInternalIP {
if address.Address != "" {
ip = address.Address
break
return address.Address
}
}
}
}
return ip
for _, address := range node.Status.Addresses {
if address.Type == apiv1.NodeExternalIP {
if address.Address != "" {
return address.Address
}
}
}
return ""
}
// PodInfo contains runtime information about the pod running the Ingres controller