Add DNS discovery support to Gitaly via client-side load-balancing options
What does this MR do and why?
In &8971 (closed), we added DNS discovery support to Praefect. This was done by making two changes:
- Configure client-side round-robin load-balancing in client dial options. We added that as a default option inside gitaly client in gitaly client since v15.9.0
- Configure DNS resolving. Due to some technical limitations, we don't use gRPC's built-in DNS resolver. Instead, we implement our own DNS resolver. This resolver is exposed via the following configuration. Afterward, gitaly can detect and handle DNS discovery automatically. The user needs to setup and set Gitaly address to something like "dns:gitaly.service.dc1.consul"
This MR also bumps the minimal Golang version to 1.18 to match Gitaly's minimal requirement.
Screenshots or screen recordings
N/A
How to set up and validate locally
-
Setup a Gitaly server bound to a port in local host. If using GDK to test, apply the included patch and run the following:
$ gdk config set praefect.enabled false # Gitaly configuration requires praefect to be disabled $ gdk config set gitaly.address dns://127.0.0.1:53/gitaly.test:9999 $ gdk reconfigure $ gdk reset-data # Optional: will create fresh repository data -
Setup a DNS service discovery pointing to above address. I use
dnsmasqwith an A record:# dnsmasq.conf port=53 address=/gitaly.test/127.0.0.1 # If testing on GDK use the listen address instead e.g. address=/gitaly.test/172.16.123.1 # See https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/af8ac99d1111d4892473b519776bd42e4b6289af/doc/howto/local_network.md#create-loopback-interface -
Configure Gitaly address in GDK accordingly:
dns://127.0.0.1:53/gitaly.test:9999, in which127.0.0.1:53is the DNS server address. -
Perform a normal pull via SSH
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Oscar Tovar

