Skip to content

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

Screenshot_2023-02-08_at_18.07.09

Screenshot_2023-02-08_at_18.09.20

  • GitLab shell

Screenshot_2023-02-08_at_18.09.45

After

Replacing Gitaly module in both Workhorse and Gitlab Shell with local Gitaly repository, all pulls now succeed.

  • Workrhorse

Screenshot_2023-02-08_at_18.05.50

  • Gitlab Shell

Screenshot_2023-02-08_at_18.05.01

Edited by Quang-Minh Nguyen

Merge request reports