Merge pull request #83331 from aojea/getporturl_ipv6

Allow ipv6 urls in GetPortURL()
This commit is contained in:
Kubernetes Prow Robot 2019-09-30 16:13:31 -07:00 committed by GitHub
commit 8826378be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -241,7 +241,8 @@ func GetPortURL(client clientset.Interface, ns, name string, svcPort int) (strin
for _, address := range node.Status.Addresses {
if address.Type == v1.NodeExternalIP {
if address.Address != "" {
return fmt.Sprintf("http://%v:%v", address.Address, nodePort), nil
host := net.JoinHostPort(address.Address, fmt.Sprint(nodePort))
return fmt.Sprintf("http://%s", host), nil
}
}
}