diff options
Diffstat (limited to 'workhorse/internal')
-rw-r--r-- | workhorse/internal/config/config.go | 6 | ||||
-rw-r--r-- | workhorse/internal/gitaly/gitaly.go | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/workhorse/internal/config/config.go b/workhorse/internal/config/config.go index 1d52a4cc934..687986974a3 100644 --- a/workhorse/internal/config/config.go +++ b/workhorse/internal/config/config.go @@ -11,6 +11,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob" + "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container" "github.com/BurntSushi/toml" "gocloud.dev/blob" "gocloud.dev/blob/azureblob" @@ -178,12 +179,13 @@ func (creds *AzureCredentials) getURLOpener() (*azureblob.URLOpener, error) { AccountName: creds.AccountName, } - clientFunc := func(svcURL azureblob.ServiceURL) (*azblob.ServiceClient, error) { + clientFunc := func(svcURL azureblob.ServiceURL, containerName azureblob.ContainerName) (*container.Client, error) { sharedKeyCred, err := azblob.NewSharedKeyCredential(creds.AccountName, creds.AccountKey) if err != nil { return nil, fmt.Errorf("error creating Azure credentials: %w", err) } - return azblob.NewServiceClientWithSharedKey(string(svcURL), sharedKeyCred, &azblob.ClientOptions{}) + containerURL := fmt.Sprintf("%s/%s", svcURL, containerName) + return container.NewClientWithSharedKeyCredential(containerURL, sharedKeyCred, &container.ClientOptions{}) } return &azureblob.URLOpener{ diff --git a/workhorse/internal/gitaly/gitaly.go b/workhorse/internal/gitaly/gitaly.go index af7425be1cf..eace87dda36 100644 --- a/workhorse/internal/gitaly/gitaly.go +++ b/workhorse/internal/gitaly/gitaly.go @@ -192,6 +192,16 @@ func newConnection(server api.GitalyServer) (*grpc.ClientConn, error) { ), ), ), + + // In https://gitlab.com/groups/gitlab-org/-/epics/8971, 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, workhorse can detect and handle DNS discovery automatically. The user needs to setup and set + // Gitaly address to something like "dns:gitaly.service.dc1.consul" + gitalyclient.WithGitalyDNSResolver(gitalyclient.DefaultDNSResolverBuilderConfig()), ) conn, connErr := gitalyclient.DialSidechannel(context.Background(), server.Address, sidechannelRegistry, connOpts) // lint:allow context.Background |