Skip to content

[API Proposal]: Choose specific AddressFamily to resolve / allow disable ipv6 address resolution in service discovery dns resolver #7437

@Dona278

Description

@Dona278

Background and motivation

By using service discovery within a kubernetes cluster (with DnsServiceEndpointProvider) we have a lot of warnings for Query AAAA xxx-service.default.svc.cluster.local on 11.0.0.10:53 attempt 1: no data matching given query type. which is "ok" because no ipv6 is provided / enabled by kubernetes cluster.

API Proposal

public class DnsResolverOptions
{
+    /// <summary>
+    /// Gets or sets family address that will be resolved.
+    /// </summary>
+    /// <remarks>
+    /// Only <see="AddressFamily.InterNetwork" /> and / or <see="AddressFamily.InterNetworkV6" /> can be used.
+    /// </remarks>
+    public AddressFamily[]? AddressFamilies { get; set; }
}

cons: user must know what address family can set, so it can set wrong values which need to be checked.

or

public class DnsResolverOptions
{
+    /// <summary>
+    /// Gets or sets whether the IPV6 address will be resolved or not.
+    /// </summary>
+    public bool DisableIPV6AddressResolution { get; set; }
}

more explicit, the IPV4 is always resolved.

API Usage

.ConfigureDnsResolver(options =>
{
    // Disable IPV6 address resolution not provided by kubernetes
    options.AddressFamilies = [AddressFamily.InterNetwork];
    // or
    options.DisableIPV6AddressResolution = true;
})

Alternative Designs

No response

Risks

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions