[DISCUSS] PIP-305: Customize DNSes to use for Pulsar Client

2023-10-12 Thread Diego Salvi
Hi Pulsar Community,

This is a PIP discussion on how support custom DNSes configuration to be
used by the Pulsar Client.

This is the PIP issue https://github.com/apache/pulsar/pull/21352

# Motivation

Currently Pulsar client levereage on JVM detected DNSes or on Google DNSes
if nothing was found (as per Netty default). You cannot change which DNSes
use to resolve hostnames but you are forced to use local server one (like
DNSes configured through resolv.conf or similar ways) or leverage on some
Netty "black magic" system properties.

The ability to directly configure which DNSes use is strictly necessary in
environment with "specialized" DNSes.

# Goals

## In Scope

Add a new configuration on Pulsar client to explicitly set which DNSes use.

## Out of Scope

Fully configure DNS layer, properties, timeouts etcetera.


# High Level Design

A new client configuration will be added to list wich DNSes use. Such
configuration will be checked when creating Pulsar clients to instantiate
the DNS resolver.
If no configuration is provided the client must use current defaults.


# Detailed Design

## Design & Implementation Details

The new configuration will be read from
org.apache.pulsar.client.impl.ConnectionPool to configure a
DnsNameResolverBuilder

## Public-facing Changes
Add new dnsServerAddresses method on
org.apache.pulsar.client.api.ClientBuilder.

There are no breaking changes, if dnsServerAddresses is not configuret
Pulsar will continue to behave like now.


### Public API

NA

### Binary protocol

NA

### Configuration

Add new dnsServerAddresses property on
org.apache.pulsar.client.impl.conf.ClientConfigurationData.

### CLI

NA

### Metrics

NA

# Monitoring

NA

# Security Considerations

The client will have the ability to use a different seto of DNSes. It is
possible to alter hostnames resolutions however it is expected that this
does not pose any security risks.

# Backward & Forward Compatibility

## Revert

Just remove dnsServerAddresses configuration

## Upgrade

Configure a dnsServerAddresses server list. The configuration is not
mandatory, Pulsar can run without it just like before.

# Alternatives

Expose an interface builder to fully configure the DNS layer. It has much
more impact and conflict with existing configuration properties
dnsLookupBindAddress and dnsLookupBindPort.

Diego Salvi


Re: [DISCUSS] PIP-305: Customize DNSes to use for Pulsar Client

2023-10-12 Thread Dave Fisher
Please use the correct name.  “DNS Servers” not “DNSes”.What is a DNS server?cloudflare.comBest,DaveSent from my iPhoneOn Oct 12, 2023, at 8:01 AM, Diego Salvi  wrote:Hi Pulsar Community,This is a PIP discussion on how support custom DNSes configuration to beused by the Pulsar Client.This is the PIP issue https://github.com/apache/pulsar/pull/21352# MotivationCurrently Pulsar client levereage on JVM detected DNSes or on Google DNSesif nothing was found (as per Netty default). You cannot change which DNSesuse to resolve hostnames but you are forced to use local server one (likeDNSes configured through resolv.conf or similar ways) or leverage on someNetty "black magic" system properties.The ability to directly configure which DNSes use is strictly necessary inenvironment with "specialized" DNSes.# Goals## In ScopeAdd a new configuration on Pulsar client to explicitly set which DNSes use.## Out of ScopeFully configure DNS layer, properties, timeouts etcetera.# High Level DesignA new client configuration will be added to list wich DNSes use. Suchconfiguration will be checked when creating Pulsar clients to instantiatethe DNS resolver.If no configuration is provided the client must use current defaults.# Detailed Design## Design & Implementation DetailsThe new configuration will be read fromorg.apache.pulsar.client.impl.ConnectionPool to configure aDnsNameResolverBuilder## Public-facing ChangesAdd new dnsServerAddresses method onorg.apache.pulsar.client.api.ClientBuilder.There are no breaking changes, if dnsServerAddresses is not configuretPulsar will continue to behave like now.### Public APINA### Binary protocolNA### ConfigurationAdd new dnsServerAddresses property onorg.apache.pulsar.client.impl.conf.ClientConfigurationData.### CLINA### MetricsNA# MonitoringNA# Security ConsiderationsThe client will have the ability to use a different seto of DNSes. It ispossible to alter hostnames resolutions however it is expected that thisdoes not pose any security risks.# Backward & Forward Compatibility## RevertJust remove dnsServerAddresses configuration## UpgradeConfigure a dnsServerAddresses server list. The configuration is notmandatory, Pulsar can run without it just like before.# AlternativesExpose an interface builder to fully configure the DNS layer. It has muchmore impact and conflict with existing configuration propertiesdnsLookupBindAddress and dnsLookupBindPort.Diego Salvi

Re: [DISCUSS] PIP-305: Customize DNSes to use for Pulsar Client

2023-10-12 Thread Zixuan Liu
+1, LGTM

When configuring the `dnsServerAddresses`, we can configure the custom
DNS Servers for the Pulsar client in the program.

Thanks,
Zixuan

Diego Salvi  于2023年10月12日周四 23:00写道:
>
> Hi Pulsar Community,
>
> This is a PIP discussion on how support custom DNSes configuration to be
> used by the Pulsar Client.
>
> This is the PIP issue https://github.com/apache/pulsar/pull/21352
>
> # Motivation
>
> Currently Pulsar client levereage on JVM detected DNSes or on Google DNSes
> if nothing was found (as per Netty default). You cannot change which DNSes
> use to resolve hostnames but you are forced to use local server one (like
> DNSes configured through resolv.conf or similar ways) or leverage on some
> Netty "black magic" system properties.
>
> The ability to directly configure which DNSes use is strictly necessary in
> environment with "specialized" DNSes.
>
> # Goals
>
> ## In Scope
>
> Add a new configuration on Pulsar client to explicitly set which DNSes use.
>
> ## Out of Scope
>
> Fully configure DNS layer, properties, timeouts etcetera.
>
>
> # High Level Design
>
> A new client configuration will be added to list wich DNSes use. Such
> configuration will be checked when creating Pulsar clients to instantiate
> the DNS resolver.
> If no configuration is provided the client must use current defaults.
>
>
> # Detailed Design
>
> ## Design & Implementation Details
>
> The new configuration will be read from
> org.apache.pulsar.client.impl.ConnectionPool to configure a
> DnsNameResolverBuilder
>
> ## Public-facing Changes
> Add new dnsServerAddresses method on
> org.apache.pulsar.client.api.ClientBuilder.
>
> There are no breaking changes, if dnsServerAddresses is not configuret
> Pulsar will continue to behave like now.
>
>
> ### Public API
>
> NA
>
> ### Binary protocol
>
> NA
>
> ### Configuration
>
> Add new dnsServerAddresses property on
> org.apache.pulsar.client.impl.conf.ClientConfigurationData.
>
> ### CLI
>
> NA
>
> ### Metrics
>
> NA
>
> # Monitoring
>
> NA
>
> # Security Considerations
>
> The client will have the ability to use a different seto of DNSes. It is
> possible to alter hostnames resolutions however it is expected that this
> does not pose any security risks.
>
> # Backward & Forward Compatibility
>
> ## Revert
>
> Just remove dnsServerAddresses configuration
>
> ## Upgrade
>
> Configure a dnsServerAddresses server list. The configuration is not
> mandatory, Pulsar can run without it just like before.
>
> # Alternatives
>
> Expose an interface builder to fully configure the DNS layer. It has much
> more impact and conflict with existing configuration properties
> dnsLookupBindAddress and dnsLookupBindPort.
>
> Diego Salvi