Commit Graph

1357 Commits

Author SHA1 Message Date
Tobias Schmidt
422aec5f5f plugin/forward: Increase minimum read timeout to 200ms (#1889)
After several experiments at SoundCloud we found that the current
minimum read timeout of 10ms is too low. A single request against a
slow/unavailable authoritative server can cause all TCP connections to
get closed. We record a 50th percentile forward/proxy latency of <5ms,
and a 99th percentile latency of 60ms. Using a minimum timeout of 200ms
seems to be a fair trade-off between avoiding unnecessary high
connection churn and reacting to upstream failures in a timely manner.

This change also renames hcDuration to hcInterval to reflect its usage,
and removes the duplicated timeout constant to make code comprehension
easier.
2018-06-21 11:40:19 +01:00
Tobias Schmidt
e3534205c7 Rename forward metrics socket_count_total to sockets_open (#1885)
The prometheus naming convention states only counters should have a
`_total` suffix, so that gagues and counters can be easily
distinguished.
2018-06-20 11:35:57 +01:00
Miek Gieben
41c724780f remove deprecated code (#1888)
This removes:
* reverse plugin from plugin.cfg
* https_google option from proxy
* the -log flag
2018-06-20 11:35:07 +01:00
Tobias Schmidt
9c2dc7a156 Ensure cache.ResponseWriter can be used asynchronously during prefetch (#1884)
The default dns.Response implementation of a dns.ResponseWriter will
panic if RemoteAddr() is called after the connection to the client has
been closed already. The current cache implementation doesn't create a
new request+responsewriter during an asynchronous prefetch, but
piggybacks on the request triggering the prefetch.

This change copies the RemoteAddr first, so that it's safe to use it
later during the actual prefetch request.

A better implementation would be to completely decouple the prefetch
request from the client triggering a request.
2018-06-19 19:50:08 +01:00
Miek Gieben
f78f30231d Release 1.1.4 v1.1.4 2018-06-19 17:57:35 +01:00
Miek Gieben
ab9efdcac4 Follow up on #1867 : use one map in backend_lookup (#1869)
Reduce map usage and combine two maps into one; add isDuplicate that
tests and adds to make things more readable.
2018-06-18 11:16:56 +01:00
Francois Tur
6fbc1f8990 Plugin/Rewrite - review documentation of "append" (#1877)
* - ensure description of 'append' match what is encoded.

* - fix description based on review comments
2018-06-18 10:02:05 +01:00
Miek Gieben
177e32b62e plugin/forward: add REFUSED test (#1878)
add a test to see if we copy the rcode correctly. Some minor cleanup in
import ordering and renaming NewUpstream to New as we already are in the
upstream package.
2018-06-15 08:12:56 -07:00
Francois Tur
70c957d885 Plugin/Forward - autotune the dialTimeout for connection (#1852)
* - implement an auto-tunable dialTimeout for fallback.

* - fix gofmt

* - factorized timeout computation with readTimeout / updated readme /

* - fix comment
2018-06-15 07:37:22 +01:00
Miek Gieben
6f865a9de7 Run make -f Makefile.doc (#1875)
Fix typo corendns -> coredns in coredns.1
2018-06-13 11:02:14 +01:00
Miek Gieben
d6288c25ba Bump dns version to 1.0.8 (#1873)
Bump the version, allows #691 to get merged.
2018-06-13 10:38:24 +01:00
Miek Gieben
26c41a0c17 plugin/file: fix local CNAME lookup (#1866)
* plugin/file: fix local CNAME lookup

Issue #1864 explains it will, when we serve the child zone as well we
should just recursive into ourself (upstream self). Thus relax the
IsSubDomain check in file/lookup.go and just query (even if the query
will hit a remote server).

I've looped over all other plugins that do something similar (CNAME
resolving) and they didn't do the IsSubDomain check; therefor I've
removed it from *file* as well.

Added test in file_upstream_test that shows this failed before but now
results in a reply.

Fixes #1864

* self does not need to be exported

* Fix test

We don't know if we had a valid reply. Check this.
2018-06-12 14:54:37 +01:00
Miek Gieben
6e466d5092 Remove dnsutil.Dedup (#1867)
Remove the code and remove the call in etcd and kubernetes handlers.
This does mean we should not add dups in the first place, which means
adding maps in backend_lookup to prevent dups from begin added.

This should cut down on the allocations because dnsutil.Dedup is very
expensive by converting everything to strings, we avoid doing that now.
2018-06-11 19:23:25 -07:00
Miek Gieben
58d6991363 Update the pr template (#1862)
Add "Why is this needed".

I can get a description of what the PR does from the code changes,
answering the why question is more important.
2018-06-07 13:48:23 -07:00
Malcolm Akinje
18b11fc851 Normalizing Response Duration in Log Plugin (#1860)
* Current stage of the log files. Test need to be done as well as formatting of times.

* Finished testing. All altered classes test pass along with my additions

* Updated the replacer package to print the units as well. May take out.

* Changed the time units to be within the rules. Fixed the test as well.

* Fixed some tests, updated the readme, fixed the replacer class.

* Updates of standardizing only to seconds in response duration. Need to revert README.

* Reverted readme.

* Added a small test in new replacer.

* Changed replacer to inline the strconv for duration.
2018-06-07 16:21:17 +01:00
Miek Gieben
751a08d6a2 plugin/forward: fix alignment for sync.Atomic (#1855)
These must be alligned on 8 bytes, in Go this means putting them first
in the struct (AFAICT).
2018-06-05 17:21:09 +01:00
Yong Tang
ec334014d7 Update Makefile.release for docker image build (#1856)
This fix update Makefile.release for docker image build
on different platforms.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-06-05 17:20:38 +01:00
Miek Gieben
a77d9834d8 Docker: drop alpine (#1843)
* Docker: drop alpine

Create a multistage docker build image that uses debian to install certs
and then create the final image by using FROM: scratch. This creates a
(slightly) smaller images and drops busybox and alpine.

* Even less copying
2018-06-04 19:20:21 +01:00
Miek Gieben
70a53e25c9 Fix presubmit (#1850)
Uppercase these test cases as well.
2018-06-02 20:28:56 +01:00
Miek Gieben
22c0b30d5f presubmit: Check errorf as well (#1845)
Uppercase all these test errors as well. And extend the presubmit to
check for these in the future. Also do a slightly smarter grep to only
get t.<something>. as (because dump regexp) this also grep over non test
files.
2018-06-02 11:48:39 -07:00
Miek Gieben
3994d3a5a7 Add presubmit check for hyphens in filenames. (#1847)
No other fixes; this only adds the check.
2018-06-01 13:25:36 -07:00
Miek Gieben
4f0b36e57e Extend presubmit to covert test and request (#1846)
Fix the casing *and* fix use of context as we were still referencing
the non-std lib context - no wondering how this could have worked...
2018-06-01 15:12:49 +01:00
Miek Gieben
0df5eb98fe Remove the hyphen from server-https (#1844)
We use "_" every where else.

(Might add presubmit to test for this)
2018-06-01 09:34:20 +01:00
Mario Kleinsasser
6fcb2dda77 Add addition documentation for hosts plugin, fix #1825 (#1836)
Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>

Rework the documentation

Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>
2018-05-27 20:31:29 +01:00
Ruslan Drozhdzh
833e3ddaf0 plugin/forward: erase expired connections by timer (#1782)
* plugin/forward: erase expired connection by timer

 - in previous implementation, the expired connections resided in
   cache until new request to the same upstream/protocol came. In
   case if the upstream was unhealthy new request may come long time
   later or may not come at all. All this time expired connections
   held system resources (file descriptors, ephemeral ports). In my
   fix the expired connections and related resources are released
   by timer
 - decreased the complexity of taking connection from cache. The list
   of connections is treated as stack (LIFO queue), i.e. the connection
   is taken from the end of queue (the most fresh connection) and
   returned to the end (as it was implemented before). The remarkable
   thing is that all connections in the stack appear to be ordered by
   'used' field
 - the cleanup() method finds the first good (not expired) connection
   in stack with binary search, since all connections are ordered by
   'used' field

* fix race conditions

* minor enhancement

* add comments
2018-05-25 23:00:11 +01:00
Miek Gieben
94ced8255b RFC dont have a hyphen (#1837) 2018-05-25 11:43:54 +01:00
Miek Gieben
2758a756dd Implement deprecation notice for 1.1.4 (#1833)
* Implement deprecation notice for 1.1.4

This still allows all the config to be parsed, but noops it:

* -log; always set the log to stdout; no matter what.
* https_google; removed from the proxy implementation.
* reverse plugin: set to deprecated.

* Whole of reverse can go

* Remove test for deprecated plugin
2018-05-24 14:30:01 +01:00
Miek Gieben
b0fd575c65 Release 1.1.3 v1.1.3 2018-05-24 08:00:16 +01:00
Miek Gieben
c0fbef0714 generate doc for 1.1.3 (#1832) 2018-05-24 07:51:59 +01:00
Miek Gieben
4ec613e186 Enable new features of Corbot (#1831)
enable alias and add one, so that "/plugin: forward" adds a label
called plugin-forward to the issue.

enable branches that automatically delete merged branches.
2018-05-23 23:17:26 +01:00
Miek Gieben
1ae8a9e321 Add upstream unit test (#1830)
Fix the upstream unit test to actually test it.
2018-05-23 21:31:54 +01:00
darkweaver87
003e104fca ADD ignoreemptyservice option for kubernetes plugin (#1813)
* ADD: ignoreemptyservice option for kubernetes plugin

* Modify documentation and rename option to add space

* UPD: Add unit tests

* UPD: gofmt

* Add unit test for ignore emptyservice

* gofmt

* xfr tests failed

* Rename emptyservice to empty_service
2018-05-23 08:57:59 -04:00
Miek Gieben
0f74281a53 Revert pkg/nonwriter changes (#1829)
The DoH work (#1619) made changes to pkg/nonwriter.Writer that in
hindsight were not backwards compatible; it added override for the
LocalAddr() and RemoteAddr(). Instead of rolling back that PR, this PR
reverts those changes and creates a DoHWriter for use in the
https-server.go side of things.

This was only caught in the integration test making this hard to catch,
so we add a upstream_file_test.go that tries (doesn't work yet) to test
this in the unit tests as well. Esp. helpful when 'git bisecting'.

Fixes #1826
2018-05-23 08:50:27 -04:00
Ahmet Alp Balkan
49891d2103 Add links to whoami plugin reading material (#1815)
* Add links to whoami plugin reading material

* create See Also section
2018-05-22 15:38:25 +01:00
Miek Gieben
18b92e1117 make CoreDNS DoH Server (#1619)
* WIP: make CoreDNS DoH Server

* It works

* Fix tests

* Review from Tom - on diff. PR

* correct mime type

* Cleanups and use the pkg/nonwriter

* rename and updates

* implement get

* implement GET

* Code review comments

* correct context

* tweaks

* code review
2018-05-21 19:40:46 +01:00
Yong Tang
67c9075331 Enforcing gofmt -s on linter check (#1820)
This fix enforces gofmt -s on linter check in Makefile,
and fixes `plugin/kubernetes/handler_test.go` and
`plugin/tls/tls_test.go` with `gofmt -s`
2018-05-21 09:52:42 -04:00
Tobias Schmidt
0d305387f7 plugin/template: Support NODATA responses (#1816)
A NODATA response has no answers and rcode NOERROR, but should have a
SOA record in the authority section.
2018-05-21 07:45:45 +01:00
Yong Tang
a40345d65f Fix make check dependency error (#1818)
While invoking `make check` from a fresh new environment
the following failure occured:
```
[ec2-user@..... coredns]$ docker run -i -t --rm -v $PWD:/go/src/github.com/coredns/coredns -w /go/src/github.com/coredns/coredns golang:1.10
root@e2d6a6c17132:/go/src/github.com/coredns/coredns# make check
** presubmit/context
** presubmit/test-lowercase
( gometalinter --deadline=2m --disable-all --enable=goimports --vendor --exclude=^pb/ ./... || true )
/bin/sh: 1: gometalinter: not found
go generate coredns.go
```

This fix fixes the issue in Makefile so that deps could be installed first.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-05-19 23:03:32 +01:00
Ruslan Drozhdzh
7ac507d9ff plugin/forward: close connection manager in proxy finalizer (#1768)
- connManager() goroutine will stop when Proxy is about to be
   garbage collected. This means that no queries are in progress,
   and no queries are going to come
2018-05-18 07:46:14 +01:00
Chris O'Haver
38e27fd9ad add dup endpoint name test (#1811) 2018-05-18 07:27:25 +01:00
Miek Gieben
2b9d2d6c3a reload: don't fail test on addr in use (#1804)
A bit meh, but we *need* hardcoded addresses in these tests, because
we can't get them from a running coredns. These may be in-use and this
fails the tests then. Do an ugly err.Error() string match if this is the
case to prevent failing the test for something not in our control.

A better fix would be to retreive the listening address from coredns via
some api, so we could listen on :0 for these as well. No such API exists
as of yet.
2018-05-18 07:26:45 +01:00
Anton Antonov
a9f3ad1f0b Fix typo in erratic.go (#1812) 2018-05-17 16:59:57 -04:00
Yong Tang
b109a79cb5 Update kubernetes/client-go to v7.0.0 (#1808)
This fix updates k8s' client-go to v7.0.0, which matches k8s 1.10.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-05-17 07:10:28 +01:00
Yong Tang
9a82fa0374 golinter fix (#1807)
This fix fixes golinter warning:
```
plugin/tls/tls_test.go:1:⚠️ file is not goimported (goimports)
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-05-16 22:35:31 +01:00
Yong Tang
05a030e17b Vendor update with github.com/ugorji/go and github.com/apache/thrift pinning (#1805)
This fix is an vendor update. Both ugorji and thrift have to be pinned
to compile. The ugorji is from etcd and thrift is from zipkin.

This fix fixes #1802.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-05-16 22:19:53 +01:00
Miek Gieben
1e471a353e Dep ensure (#1803)
* vendor: don't vendor the context stuff

We don't need to vendor this anymore as we moved to the std lib for
these.

* new stuff showing up with dep ensure

* remove go-shlex
2018-05-16 13:17:06 -07:00
Ruslan Drozhdzh
cffa1948ab Probe simplification (#1784)
* Probe simplification

 - the main reason of rework is that previous implementation hung
   when calling Do() after Stop()

* replace atomics with mutex

* access Probe.interval under lock
2018-05-16 20:38:13 +01:00
Ruslan Drozhdzh
bffb955f69 plugin/tls: make CA parameter optional (#1800) 2018-05-15 12:53:46 -04:00
Chris O'Haver
8026dc2560 plugin/reload: mention auto in reload (#1793)
mention auto in reload docs
2018-05-11 15:09:38 -04:00
Chris O'Haver
afed91646a plugin/proxy: fix except example (#1796)
I just noticed this discrepancy in one of the `except` examples.
2018-05-11 13:51:21 -04:00