Skip to content

Fix DNS SRV provider ignoring query suffix - #7688

Open
Rimobul wants to merge 1 commit into
dotnet:mainfrom
Rimobul:lsokolovsky/issue-7175
Open

Fix DNS SRV provider ignoring query suffix#7688
Rimobul wants to merge 1 commit into
dotnet:mainfrom
Rimobul:lsokolovsky/issue-7175

Conversation

@Rimobul

@Rimobul Rimobul commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #7175

Infer Kubernetes namespace in DnsSrvServiceEndpointProviderFactory.

Add tests for suffix normalization and ServiceDomainNameCallback precedence.

Microsoft Reviewers: Open in CodeFlow

Fixes dotnet#7175

Infer Kubernetes namespace in DnsSrvServiceEndpointProviderFactory.

Add tests for suffix
normalization and ServiceDomainNameCallback precedence.
Copilot AI review requested due to automatic review settings August 7, 2026 14:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression in Microsoft.Extensions.ServiceDiscovery.Dns where the DNS SRV query-building path ignored the normalized (dot-trimmed / Kubernetes-inferred) query suffix, causing SRV lookups to use the raw configured suffix instead of the computed one.

Changes:

  • Use the factory’s normalized _querySuffix when building the default SRV query name.
  • Add regression coverage for query-suffix normalization (".ns" vs "ns").
  • Add coverage ensuring ServiceDomainNameCallback takes precedence over QuerySuffix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Libraries/Microsoft.Extensions.ServiceDiscovery.Dns/DnsSrvServiceEndpointProviderFactory.cs Passes the normalized _querySuffix into default SRV query construction to avoid ignoring inferred/normalized suffix.
test/Libraries/Microsoft.Extensions.ServiceDiscovery.Dns.Tests/DnsSrvServiceEndpointResolverTests.cs Adds regression tests for suffix normalization and callback precedence when generating SRV query names.

Comment on lines +36 to +39
/// <summary>
/// Regression test for https://github.com/dotnet/extensions/issues/7175: the query suffix used to build the SRV
/// query must be the normalized one, which has its leading dot trimmed and falls back to the inferred Kubernetes domain.
/// </summary>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Microsoft.Extensions.ServiceDiscovery.Dns doesn't respect QuerySuffix generated from k8s namespace

2 participants