diff --git a/CHANGELOG.md b/CHANGELOG.md index e9be4cdf26..e1188b6e27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re ### Changed +- [#7494](https://github.com/thanos-io/thanos/pull/7494) Ruler: remove trailing period from SRV records returned by discovery `dnsnosrva` lookups + ### Removed ## [v0.36.0](https://github.com/thanos-io/thanos/tree/release-0.36) - in progress diff --git a/pkg/discovery/dns/resolver.go b/pkg/discovery/dns/resolver.go index d0078aea57..0025178607 100644 --- a/pkg/discovery/dns/resolver.go +++ b/pkg/discovery/dns/resolver.go @@ -108,7 +108,9 @@ func (s *dnsSD) Resolve(ctx context.Context, name string, qtype QType) ([]string } if qtype == SRVNoA { - res = append(res, appendScheme(scheme, net.JoinHostPort(rec.Target, resPort))) + // Remove the final dot from rooted DNS names (this is for compatibility with Prometheus) + target := strings.TrimRight(rec.Target, ".") + res = append(res, appendScheme(scheme, net.JoinHostPort(target, resPort))) continue } // Do A lookup for the domain in SRV answer.