Join host/port with go helper (supports ipv6)

This commit is contained in:
Manuel de Brito Fontes 2018-09-09 16:34:18 -03:00
parent 0a9db37e0f
commit 361f06b791
2 changed files with 4 additions and 2 deletions

View file

@ -20,6 +20,7 @@ import (
"fmt"
"net"
"reflect"
"strconv"
"github.com/golang/glog"
@ -100,7 +101,7 @@ func getEndpoints(s *corev1.Service, port *corev1.ServicePort, proto corev1.Prot
}
for _, epAddress := range ss.Addresses {
ep := fmt.Sprintf("%v:%v", epAddress.IP, targetPort)
ep := net.JoinHostPort(epAddress.IP, strconv.Itoa(int(targetPort)))
if _, exists := processedUpstreamServers[ep]; exists {
continue
}