mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
Fix etcd egress dialer addr parsing
This commit is contained in:
parent
19db126d76
commit
a26c392de1
@ -22,6 +22,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
@ -137,11 +138,15 @@ func newETCD3Client(c storagebackend.TransportConfig) (*clientv3.Client, error)
|
|||||||
}
|
}
|
||||||
if egressDialer != nil {
|
if egressDialer != nil {
|
||||||
dialer := func(ctx context.Context, addr string) (net.Conn, error) {
|
dialer := func(ctx context.Context, addr string) (net.Conn, error) {
|
||||||
|
if strings.Contains(addr, "//") {
|
||||||
|
// etcd client prior to 3.5 passed URLs to dialer, normalize to address
|
||||||
u, err := url.Parse(addr)
|
u, err := url.Parse(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return egressDialer(ctx, "tcp", u.Host)
|
addr = u.Host
|
||||||
|
}
|
||||||
|
return egressDialer(ctx, "tcp", addr)
|
||||||
}
|
}
|
||||||
dialOptions = append(dialOptions, grpc.WithContextDialer(dialer))
|
dialOptions = append(dialOptions, grpc.WithContextDialer(dialer))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user