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

plugin/timeouts - Allow ability to configure listening server timeouts #5784

Merged
merged 9 commits into from
Dec 28, 2022

Conversation

rlees85
Copy link
Contributor

@rlees85 rlees85 commented Nov 29, 2022

1. Why is this pull request needed and what does it do?

Creates a "timeouts" plugin for configuring the listening server timeouts. Applies to TCP, DNS-over-TLS, DNS-over-HTTPS.

CoreDNS currently has a hard-coded 2 second read timeout for TCP/TLS connections and 5 seconds for HTTPS. This appears to be optimised for local network and/or Kubernetes environments where CoreDNS is most often used. Where CoreDNS is acting as a resolver on the public Internet this 2 second timeout can cause problems particularly on 3G/4G/5G connections where there might be lag.

It also removes the limit of queries per connection since we are enforcing timeouts this makes no sense and can cause some devices to think the DNS server is faulty.

It also removes the 128 requests per connection limit.

Corefile is also added to .gitignore for easier testing. Happy to revert this if preferred.

See more details in below.

2. Which issues (if any) are related?

#5780

3. Which documentation changes (if any) need to be made?

Plugin documentation - included.

4. Does this introduce a backward incompatible change or deprecation?

The only possible issue would be clients that expect the server to close the connection after 128 requests which feels very unlikely.

core/dnsserver/server.go Outdated Show resolved Hide resolved
core/dnsserver/server_https.go Outdated Show resolved Hide resolved
core/dnsserver/server_tls.go Outdated Show resolved Hide resolved
plugin/pkg/timeouts/timeouts.go Outdated Show resolved Hide resolved
Signed-off-by: Rich <git0@bitservices.io>
@rlees85 rlees85 changed the title [WIP] plugin/timeouts plugin/timeouts - Allow ability to configure listening server timeouts Dec 6, 2022
Signed-off-by: Rich <git0@bitservices.io>
Signed-off-by: Rich <git0@bitservices.io>
Signed-off-by: Rich <git0@bitservices.io>
@rlees85
Copy link
Contributor Author

rlees85 commented Dec 6, 2022

I think this is as far as I can take this PR. Any guidance in making it good enough for merge would be appreciated. I am not 100% familiar with everything that's going on in CoreDNS and this is my first attempt at Go so only happy to take criticism/suggestions.

Copy link
Collaborator

@Tantalor93 Tantalor93 left a comment

Choose a reason for hiding this comment

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

Hello, thanks for your contribution! Although I have some objections regarding plugin configuration, please consider adjusting how the plugin will be configured

core/dnsserver/server.go Outdated Show resolved Hide resolved
core/dnsserver/config.go Outdated Show resolved Hide resolved
plugin/timeouts/README.md Outdated Show resolved Hide resolved
plugin/timeouts/README.md Outdated Show resolved Hide resolved
Signed-off-by: Rich <git0@bitservices.io>
@rlees85
Copy link
Contributor Author

rlees85 commented Dec 13, 2022

Changes submitted for how the plugin should be configured

Signed-off-by: Rich <git0@bitservices.io>
Copy link
Collaborator

@Tantalor93 Tantalor93 left a comment

Choose a reason for hiding this comment

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

overall looks good to me, I would just make few quality improvements 👍

plugin/pkg/timeouts/timeouts.go Outdated Show resolved Hide resolved
plugin/pkg/timeouts/timeouts.go Outdated Show resolved Hide resolved
plugin/timeouts/timeouts.go Outdated Show resolved Hide resolved
plugin/pkg/timeouts/timeouts_test.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2022

Codecov Report

Merging #5784 (fc2788c) into master (93c57b6) will increase coverage by 1.58%.
The diff coverage is 56.79%.

@@            Coverage Diff             @@
##           master    #5784      +/-   ##
==========================================
+ Coverage   55.70%   57.28%   +1.58%     
==========================================
  Files         224      245      +21     
  Lines       10016    15731    +5715     
==========================================
+ Hits         5579     9011    +3432     
- Misses       3978     6173    +2195     
- Partials      459      547      +88     
Impacted Files Coverage Δ
core/dnsserver/config.go 0.00% <ø> (ø)
plugin/auto/auto.go 0.00% <0.00%> (ø)
plugin/auto/zone.go 78.94% <ø> (+0.68%) ⬆️
plugin/autopath/autopath.go 73.61% <ø> (-1.39%) ⬇️
plugin/azure/azure.go 10.61% <0.00%> (-0.57%) ⬇️
plugin/azure/setup.go 56.36% <0.00%> (-4.14%) ⬇️
plugin/backend_lookup.go 0.00% <0.00%> (ø)
plugin/bind/bind.go 50.00% <0.00%> (-50.00%) ⬇️
plugin/clouddns/gcp.go 0.00% <0.00%> (ø)
plugin/clouddns/setup.go 55.40% <0.00%> (+0.68%) ⬆️
... and 316 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rlees85
Copy link
Contributor Author

rlees85 commented Dec 15, 2022

Thanks @Tantalor93 I will try and get on these improvements when I get a moment

Signed-off-by: Rich <git0@bitservices.io>
Signed-off-by: Rich <git0@bitservices.io>
@rlees85
Copy link
Contributor Author

rlees85 commented Dec 16, 2022

Hopefully that should cover the comments unless I've messed something up (i've ran go tests/etc locally so hopefully not!)

Copy link
Collaborator

@Tantalor93 Tantalor93 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for your contribution!

@Tantalor93 Tantalor93 merged commit e7ad486 into coredns:master Dec 28, 2022
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.

5 participants