Skip to content

Commit

Permalink
Merge pull request #3065 from aledbf/joinhp
Browse files Browse the repository at this point in the history
Join host/port with go helper (supports ipv6)
  • Loading branch information
k8s-ci-robot authored Sep 10, 2018
2 parents ef2f387 + 361f06b commit 20f770b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/ingress/controller/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"net"
"reflect"
"strconv"

"github.com/golang/glog"

Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/settings/proxy_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"io/ioutil"
"net"
"strconv"
"strings"

. "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -66,7 +67,7 @@ var _ = framework.IngressNginxDescribe("Proxy Protocol", func() {
port, err := f.GetNginxPort("http")
Expect(err).NotTo(HaveOccurred())

conn, err := net.Dial("tcp", fmt.Sprintf("%v:%v", ip, port))
conn, err := net.Dial("tcp", net.JoinHostPort(ip, strconv.Itoa(port)))
Expect(err).NotTo(HaveOccurred())
defer conn.Close()

Expand Down

0 comments on commit 20f770b

Please sign in to comment.