Skip to content

DnsNameResolver uses Jndi and does not allow to use a different dns resolver #5218

Description

@Necropaw

Please answer these questions before submitting your issue.

What version of gRPC are you using?

1.17.1

What did you expect to see?

An easy way to configure a different DNS resource resolver like netty dns because of a bug in the JNDI dns resolver.
In code we want to use a different implementation for io.grpc.internal.DnsNameResolver.ResourceResolver

Background

The implementation of the DnsNameResolver uses JNDI to resolve additonial records (like SRV and TXT). Unfortunately the JNDI implementation has a bug so that FQDN have to be used (see. https://bugs.openjdk.java.net/browse/JDK-8170306).

In our kubernetes environment are multiple namespaces for different stages (e.g.: dev, test, pre, ...) and the bug in OpenJDK requires to use the FQDN for a grpclb address, e.g.: service-foo-grpclb.dev.svc.cluster.local instead of just service-foo-grpclb.

Problem

The current implementation has no way to change the resource resolver without reimplementing the io.grpc.internal.DnsNameResolverProvider and io.grpc.internal.DnsNameResolver (= Copy & Paste over 700 lines of code) because of this:

  private static final ResourceResolverFactory resourceResolverFactory =
      getResourceResolverFactory(DnsNameResolver.class.getClassLoader());

In addition the DnsNameResolver contains logic for different cases (like grpc lb - which we need) and is much more than just a simple dns name resolver.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions