grpclb: no SRV lookup for "metadata.google.internal."

This change is to address b/269159638 about GCP metadata server returning an unexpected REFUSED status instead of NXDOMAIN. This causes a 15s delay with older versions of systemd-resolved.

This issue was observed with systemd 245.4. Version 251 worked without issue.
This commit is contained in:
Terry Wilson 2023-02-16 12:57:54 -08:00 committed by GitHub
parent 3fb9abcb2c
commit e3bd5baeda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -76,7 +76,10 @@ final class GrpclbNameResolver extends DnsNameResolver {
ResourceResolver resourceResolver = getResourceResolver();
if (resourceResolver != null) {
try {
srvRecords = resourceResolver.resolveSrv(GRPCLB_NAME_PREFIX + getHost());
// This host behaves "unconventionally" with SRV records - we exclude it here.
if (!getHost().equals("metadata.google.internal.")) {
srvRecords = resourceResolver.resolveSrv(GRPCLB_NAME_PREFIX + getHost());
}
} catch (Exception e) {
srvRecordsException = e;
}