Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom DNS resolution #827

Closed
LucioFranco opened this issue Sep 3, 2019 · 19 comments
Closed

Support custom DNS resolution #827

LucioFranco opened this issue Sep 3, 2019 · 19 comments
Assignees
Labels
domain: topology Anything related to Vector's topology code meta: idea Anything in the idea phase. Needs further discussion and consensus before work can begin. type: feature A value-adding code addition that introduce new functionality.

Comments

@LucioFranco
Copy link
Contributor

LucioFranco commented Sep 3, 2019

As we start to support more cloud native environments users will probably want to use custom DNS resolution to find downstream services. An example of this would be using consul's DNS server to find some downstream sink. Vector should have this support out of the box.

Use case

As a user, I want vector to be able to find downstream services using custom DNS resolution configuration.

Solution

Allow users to supply custom DNS servers or configurations and let Vector pick them up so that they can be used when attempting to connect to a downstream service. In environments like k8 they expose their services via DNS and it is a native protocol for doing service discovery. This will become increasingly useful as Vector gets deployed in more complex cloud environments.

@LucioFranco LucioFranco added domain: topology Anything related to Vector's topology code type: new feature meta: idea Anything in the idea phase. Needs further discussion and consensus before work can begin. labels Sep 3, 2019
@binarylogic
Copy link
Contributor

@LucioFranco can you provide more detail on this? Which sinks would need this? It's not clear on this issue what work actually needs to be done.

@LucioFranco
Copy link
Contributor Author

@binarylogic I updated the description should be more clear now.

@binarylogic binarylogic added this to the Initial containers support milestone Sep 8, 2019
@ktff ktff self-assigned this Sep 24, 2019
@ktff
Copy link
Contributor

ktff commented Sep 24, 2019

Implementation

Core

Add custom name resolver which vector should use on top of the current one. This resolver would be configured by new global option

    # IP:port of DNS servers. If name resolution with specified servers fails,  
    # OS resolver will be used. If port is not specified, it's assumed to be 
    # DNS port 53.
    # 
    # * optional
    dns = ["1.1.1.1:53","8.8.8.8"]

Resolver will query DNS servers for A and AAAA records.

It would be good to have all name resolutions done by this resolver to provide simpler UX. This would require modifying sinks: elasticsearch sink, http sink, splunk_hec sink, clickhouse sink, vector sink, kafka sink, and tcp sink. For that, SinkConfig::build method could be changed to accept additional configuration as currently there is no clean way of providing additional configuration to Sinks. GlobalOptions is a good candidate to pass. And of sources, kafka source needs to be modified. And any other occurrence of name resolution that I've maybe missed.

Extensions

There are ways to make sink/source discovery even more user friendly in environments like Kubernetes for which this is a good base on which they could be individually added.

@ktff
Copy link
Contributor

ktff commented Oct 1, 2019

@LucioFranco @binarylogic could you review this.

@LucioFranco
Copy link
Contributor Author

@ktff I think this makes sense! For the latter part we probably want to update the connector, I think @bruceg change recently touched that part.

@binarylogic
Copy link
Contributor

@ktff this looks good to me. What would the default be for this? I assume we'd offer DNS resolution by default, without any configuration, correct?

@binarylogic
Copy link
Contributor

And to clarify, let's proceed with this. Feel free to begin work unless you have any other outstanding questions or blockers.

@ktff
Copy link
Contributor

ktff commented Oct 14, 2019

What would the default be for this? I assume we'd offer DNS resolution by default, without any configuration, correct?

@binarylogic Yes, default DNS resolution will be that of OS, while the provided DNS servers will have priority over OS.

@LucioFranco
Copy link
Contributor Author

@lukesteensen do you think we should bundle some of this with more consolidation of our http client. Like removing the default rusoto client and instead use a custom hyper client with our own connector so that we can provide our own DNS resolution? Not sure how worth it might be.

@lukesteensen
Copy link
Member

I don't have a good sense of how much work that would be. I'm also not sure how often people will want custom DNS resolution of AWS services.

@ktff
Copy link
Contributor

ktff commented Oct 22, 2019

@LucioFranco I don't think there is a need for that, since not all DNS resolutions are done over http client. And changing HttpService to use different resolver is a small task.

@LucioFranco
Copy link
Contributor Author

@ktff you're right, we should though implement the DNS resolver as a tower service. I know hyper will be adding support for this in 0.13.

@lukesteensen its pretty much this https://github.com/LucioFranco/tower-rusoto/blob/master/src/lib.rs but it would be nice for us to all use one http client throughout all of vector imo.

@ktff
Copy link
Contributor

ktff commented Oct 23, 2019

we should though implement the DNS resolver as a tower service

@LucioFranco do you mean implementing hyper::client::connect::dns::Resolve trait?

@LucioFranco
Copy link
Contributor Author

Yes, but that is moving to become a tower_service in hyper 0.13 hyperium/hyper#1903

@ktff
Copy link
Contributor

ktff commented Oct 24, 2019

I think it isn't worth the wait. Since they will be just aliasing it, updating implementation to this new version will be easy. I can also write this so that only HttpService depends on trait Resolve. Then when dependency to hyper is updated to 0.13, this could be updated as well.

@LucioFranco
Copy link
Contributor Author

Oh not suggesting we move, but thinking we may just want to towerize it anyways.

@ktff
Copy link
Contributor

ktff commented Oct 24, 2019

I agree, then I'll implement this as a Service with Resolve shim on top of it to interface with the http client.

@LucioFranco
Copy link
Contributor Author

Update: Once #1118 is merged, we can start work on reworking our internal traits to support passing down the resolver. This will allow our sinks to use it as either a HttpConnector or use it to manually resolve ips.

@binarylogic
Copy link
Contributor

Closing this since #1118 resolved the core issue. We will be opening a follow up issue for each sink's implementation.

@binarylogic binarylogic removed this from the Initial Containers Support milestone Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: topology Anything related to Vector's topology code meta: idea Anything in the idea phase. Needs further discussion and consensus before work can begin. type: feature A value-adding code addition that introduce new functionality.
Projects
None yet
Development

No branches or pull requests

4 participants