Skip to content

Fix DNS SRV provider ignoring query suffix - #7688

Merged
jeffhandley merged 2 commits into
dotnet:mainfrom
Rimobul:lsokolovsky/issue-7175
Aug 11, 2026
Merged

Fix DNS SRV provider ignoring query suffix#7688
jeffhandley merged 2 commits 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.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@jeffhandley jeffhandley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, @Rimobul!

@jeffhandley
jeffhandley merged commit 1cfcfb4 into dotnet:main Aug 11, 2026
5 checks passed
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

3 participants