Fix ingress status regression introduced in #4490 (#4871)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-12-30 20:46:20 -03:00 committed by GitHub
parent aba58d67f2
commit f0f9618a89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 136 additions and 89 deletions

View file

@ -48,16 +48,20 @@ 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
}
defaultOrInternalIP := ""
for _, address := range node.Status.Addresses {
if address.Type == apiv1.NodeInternalIP {
if address.Address != "" {
defaultOrInternalIP = address.Address
break
}
}
}
if useInternalIP {
return defaultOrInternalIP
}
for _, address := range node.Status.Addresses {
if address.Type == apiv1.NodeExternalIP {
if address.Address != "" {
@ -66,7 +70,7 @@ func GetNodeIPOrName(kubeClient clientset.Interface, name string, useInternalIP
}
}
return ""
return defaultOrInternalIP
}
// PodInfo contains runtime information about the pod running the Ingres controller