mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #13712 from ahrtr/correct_dns_etcd_client
Trim the suffix dot from the srv.Target for etcd-client DNS lookup
This commit is contained in:
commit
20bf96dc40
@ -16,6 +16,7 @@ See [code changes](https://github.com/etcd-io/etcd/compare/v3.5.0...v3.6.0).
|
||||
|
||||
- Add command to generate [shell completion](https://github.com/etcd-io/etcd/pull/13133).
|
||||
- When print endpoint status, [show db size in use](https://github.com/etcd-io/etcd/pull/13639)
|
||||
- [Trim the suffix dot from the target](https://github.com/etcd-io/etcd/pull/13712) in SRV records returned by DNS lookup.
|
||||
|
||||
### etcdutl v3
|
||||
|
||||
|
@ -106,9 +106,10 @@ func GetClient(service, domain string, serviceName string) (*SRVClients, error)
|
||||
return err
|
||||
}
|
||||
for _, srv := range addrs {
|
||||
shortHost := strings.TrimSuffix(srv.Target, ".")
|
||||
urls = append(urls, &url.URL{
|
||||
Scheme: scheme,
|
||||
Host: net.JoinHostPort(srv.Target, fmt.Sprintf("%d", srv.Port)),
|
||||
Host: net.JoinHostPort(shortHost, fmt.Sprintf("%d", srv.Port)),
|
||||
})
|
||||
}
|
||||
srvs = append(srvs, addrs...)
|
||||
|
@ -226,8 +226,8 @@ func TestSRVDiscover(t *testing.T) {
|
||||
},
|
||||
{
|
||||
[]*net.SRV{
|
||||
{Target: "a.example.com", Port: 2480},
|
||||
{Target: "b.example.com", Port: 2480},
|
||||
{Target: "a.example.com.", Port: 2480},
|
||||
{Target: "b.example.com.", Port: 2480},
|
||||
{Target: "c.example.com", Port: 2480},
|
||||
},
|
||||
[]*net.SRV{},
|
||||
|
Loading…
x
Reference in New Issue
Block a user