Fix etcd egress dialer addr parsing
Kubernetes-commit: a26c392de176494f2c425f712bc49fc399e9ce6d
This commit is contained in:
parent
aaf5f32453
commit
2f8b9e4dbc
|
@ -22,6 +22,7 @@ import (
|
|||
"net"
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
@ -137,11 +138,15 @@ func newETCD3Client(c storagebackend.TransportConfig) (*clientv3.Client, error)
|
|||
}
|
||||
if egressDialer != nil {
|
||||
dialer := func(ctx context.Context, addr string) (net.Conn, error) {
|
||||
u, err := url.Parse(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if strings.Contains(addr, "//") {
|
||||
// etcd client prior to 3.5 passed URLs to dialer, normalize to address
|
||||
u, err := url.Parse(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
addr = u.Host
|
||||
}
|
||||
return egressDialer(ctx, "tcp", u.Host)
|
||||
return egressDialer(ctx, "tcp", addr)
|
||||
}
|
||||
dialOptions = append(dialOptions, grpc.WithContextDialer(dialer))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue