Skip to content

Commit dc26fee

Browse files
dfawleytownba
andauthored
credentials/alts: avoid SRV and TXT lookups for handshaker service (#7861) (#7873)
Co-authored-by: Brad Town <townba@users.noreply.github.com>
1 parent eff4b16 commit dc26fee

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

credentials/alts/internal/handshaker/service/service.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ func Dial(hsAddress string) (*grpc.ClientConn, error) {
4747
if !ok {
4848
// Create a new connection to the handshaker service. Note that
4949
// this connection stays open until the application is closed.
50+
// Disable the service config to avoid unnecessary TXT record lookups that
51+
// cause timeouts with some versions of systemd-resolved.
5052
var err error
51-
hsConn, err = grpc.Dial(hsAddress, grpc.WithTransportCredentials(insecure.NewCredentials()))
53+
hsConn, err = grpc.Dial(hsAddress, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDisableServiceConfig())
5254
if err != nil {
5355
return nil, err
5456
}

internal/resolver/dns/dns_resolver.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ func (d *dnsResolver) watcher() {
237237
}
238238

239239
func (d *dnsResolver) lookupSRV(ctx context.Context) ([]resolver.Address, error) {
240-
if !EnableSRVLookups {
240+
// Skip this particular host to avoid timeouts with some versions of
241+
// systemd-resolved.
242+
if !EnableSRVLookups || d.host == "metadata.google.internal." {
241243
return nil, nil
242244
}
243245
var newAddrs []resolver.Address

0 commit comments

Comments
 (0)