dnsresolver: Support DNS scheme in client dial functions
Previously, we implemented a custom DNS resolver. This resolver handles all Gitaly URL having dns scheme. The exposed dial functions (client.Dial
, client.DialContext
, and client.DialSidechannel
) in client package should work well with this scheme. In fact, we added some tests to verify. However, it turns out the tests use grpc.Dial
, instead of
exposed aforementioned dial functions. Hence, after rolling the resolver, the client could not use URLs with DNS scheme. They all fail to create a connection with DNS connection string.
This commit fixes this problem. In addition, the test is strengthen to cover such cases.
How to verify locally?
- Setup a Gitaly server bound to a port in local host. We can setup in GDK, but it requires some changes
- Setup a DNS service discovery pointing to above address. I use
dnsmasq
with an A record:
port=53
address=/gitaly.test/127.0.0.1
address=/gitaly.test/127.0.0.2
- Configure Gitaly address in workhorse and gitlab-shell accordingly, in which
127.0.0.1:53
is the DNS server address.
repositories:
storages: # You must have at least a `default` storage path.
default:
path: /path/to/repositories
gitaly_address: dns://127.0.0.1:53/gitaly.test:9999
Before
- Workhorse
- GitLab shell
After
Replacing Gitaly module in both Workhorse and Gitlab Shell with local Gitaly repository, all pulls now succeed.
- Workrhorse
- Gitlab Shell
Edited by Quang-Minh Nguyen