diff --git a/internal/utils/net/port.go b/internal/utils/net/port.go index baa4fd10ac6..518e18643b0 100644 --- a/internal/utils/net/port.go +++ b/internal/utils/net/port.go @@ -8,7 +8,6 @@ package net import ( "fmt" "net" - "strconv" ) const ( @@ -23,7 +22,3 @@ func LocalAvailablePort() (int, error) { return l.Addr().(*net.TCPAddr).Port, l.Close() } - -func JoinHostPort(host string, port int) string { - return net.JoinHostPort(host, strconv.Itoa(port)) -} diff --git a/internal/xds/bootstrap/bootstrap.go b/internal/xds/bootstrap/bootstrap.go index 5d3993e6c69..e8aab4d836a 100644 --- a/internal/xds/bootstrap/bootstrap.go +++ b/internal/xds/bootstrap/bootstrap.go @@ -9,13 +9,15 @@ import ( // Register embed _ "embed" "fmt" + "net" + "strconv" "strings" "text/template" "k8s.io/apimachinery/pkg/util/sets" egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1" - "github.com/envoyproxy/gateway/internal/utils/net" + netutils "github.com/envoyproxy/gateway/internal/utils/net" "github.com/envoyproxy/gateway/internal/utils/regex" ) @@ -199,9 +201,9 @@ func GetRenderedBootstrapConfig(opts *RenderBootstrapConfigOptions) (string, err host, port = *sink.OpenTelemetry.Host, uint32(sink.OpenTelemetry.Port) } if len(sink.OpenTelemetry.BackendRefs) > 0 { - host, port = net.BackendHostAndPort(sink.OpenTelemetry.BackendRefs[0].BackendObjectReference, "") + host, port = netutils.BackendHostAndPort(sink.OpenTelemetry.BackendRefs[0].BackendObjectReference, "") } - addr := net.JoinHostPort(host, int(port)) + addr := net.JoinHostPort(host, strconv.Itoa(int(port))) if addresses.Has(addr) { continue }