Allow ipv6 urls in GetPortURL()

This commit is contained in:
Antonio Ojea 2019-09-30 19:59:50 +02:00
parent 974f201363
commit 5e6eb467ac
No known key found for this signature in database
GPG Key ID: E4833AA228D4E824

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
}
}
}