Commit graph

1208 commits

Author SHA1 Message Date
Harshavardhana
367ed65f22 Fix default endpoint port (#1490) 2018-02-06 07:07:43 +00:00
Miek Gieben
5b844b5017
plugin/forward: add it (#1447)
* plugin/forward: add it

This moves coredns/forward into CoreDNS. Fixes as a few bugs, adds a
policy option and more tests to the plugin.

Update the documentation, test IPv6 address and add persistent tests.

* Always use random policy when spraying

* include scrub fix here as well

* use correct var name

* Code review

* go vet

* Move logging to metrcs

* Small readme updates

* Fix readme
2018-02-05 22:00:47 +00:00
Miek Gieben
fb1cafe5fa
pkg/up: add generic run-this-functions (#1481)
This adds a generic way of start a check function to check a backend.
This package can be used to kick off healthchecks. The package makes
sure only 1 is run at any one time.

It should allow for:
See upstream error -> kick off healthcheck

and not to worry about overwhelming the upstream with a barrage of
queries.
2018-02-05 22:00:29 +00:00
Francois Tur
2440024772 Plugin/RELOAD - Tune usage of var global, add limit to options (#1457)
* tune usage of var global, add limit to options

* update readme for minimal values

* useless change to quick-off codecov

* fix msgs for min values and tune the flag for end of reload usage, with a 'maybe' option

* adding UT for min values, adding MD5 of corefile on the log
2018-02-02 13:15:56 -05:00
Uladzimir Trehubenka
3fb07161b7 Fixed dnstap panic after graceful restart (send on closed channel) (#1479) 2018-02-02 11:59:22 +02:00
Francois Tur
b93a36b213 Plugin/Proxy - add new policy always_first to mimic windows dns resolvers (#1459)
* add new policy always_first to mimic windows dns resolvers
fill documentation, add UT and cleanup fmt

* change name of policy from always_first to first. Update docs
2018-01-30 16:29:49 -05:00
Tobias Schmidt
0af9b9b16f plugin/proxy: Fix unnecessary message truncation (#1477)
As plugin/proxy always returns compressed messages, it's important to
set this before calling Scrub(), as some messages will be unnecessarily
truncated otherwise.
2018-01-30 23:18:44 +02:00
Tobias Schmidt
64d7268ed6 plugin/proxy: Don't enable HTTP healthchecking if not configured (#1441)
HTTP healthchecking will be implicitely activated for proxy upstream
hosts, even if not configured. The README states that not using the
health_check directive will disable HTTP healthchecks though.

It seems to me that the availability of the HealthCheck.Path attribute
is used as indicator whether HTTP healthchecks should be used or not.
The normalizeCheckURL() function didn't check that attribute though,
always returning a CheckURL. This would increase the healthcheck failure
on every third failure in plugin/proxy, without any possibility for the
upstream host to be marked as healthy again. This would eventually
remove all upstream hosts from the serving pool.
2018-01-30 23:10:07 +02:00
Yong Tang
2b268134e9
Golint fix (#1475)
Golint fix to make goreportcard happy

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-30 09:31:39 -08:00
Miek Gieben
f91cb61086 Don't use standard lib context package (#1468)
With Go 1.9 you *can* include the std lib's context package and nothing
breaks. However we never officially made the move (and grpc also doesn't
ues the std lib's one).

Standardize all plugins on using the extern context package.

Fixes #1466
2018-01-30 09:19:37 -05:00
Chris O'Haver
449bb1ac6c
spelling (#1461) 2018-01-29 13:16:13 -05:00
Miek Gieben
399073ec6b pl/kubernetes: drop the comma parsing (#1453)
Let caddyfile parser give us the token, the comma sep thing also didn't
work.

Fixes #1446
2018-01-28 08:40:10 -08:00
John Belamaric
d27be86e3e
Minor refactor of proxy parsing to make upstreams re-usable in other plugins (#1426) 2018-01-27 17:25:39 -05:00
John Belamaric
0b35d4d28f Reload hook (#1445)
* Add reload directive

* gofmt

* Fix default jitter and error message

* remove unneeded call to NextArg, add a couple negative setup tests

* Review feedback
2018-01-27 10:42:57 +00:00
Pat Moroney
4b5fc3002e correct typo from hosts to route53 (#1437) 2018-01-25 23:17:47 +00:00
Ilya Galimyanov
1e75061aec Remove pointers to labels.Selector and pass normally instead (#1422) 2018-01-24 20:44:18 +00:00
Tobias Schmidt
a0ad2ff0af plugin/etcd: Remove unnecessary test cases (#1421)
These test cases became invalid with the fix of message truncation and
don't validate anything.
2018-01-24 14:09:57 +00:00
Tobias Schmidt
697e2b4bda Fix truncation of messages longer than permitted by the client (#1417)
* Fix truncation of messages longer than permitted by the client

CoreDNS currently doesn't respect the maximum response size advertised
by the client and returns the full answer on a message with the TC bit
set. This breaks client implementations which rely on DNS servers
respecting the advertised size limit, for example the Ruby stdlib
client. It also has negative network performance implications, as large
messages will be split up into multiple UDP packets, even though the
client will discard the truncated response anyway.

While RFC 2181 permits the response of partial RRSets, finding the
correct number of records fitting into the advertised response size is
non-trivial. As clients should ignore truncated messages, this change
simply removes the full RRSet on truncated messages.

* Remove incorrect etcd test assertion

If a client requests a TXT record larger than its advertised buffer
size, a DNS server should _not_ respond with the answer, but truncate
the message and set the TC bit, so that the client can retry using TCP.
2018-01-24 13:28:26 +00:00
Tobias Schmidt
b707438534 Add coredns_build_info metric (#1418)
In order to track the rollout status of CoreDNS versions, add the common
build_info metric.
2018-01-23 20:10:55 +00:00
Francois Tur
f9c03c2ead fix computation of reverse zone based on Ipv6 CIDRs (#1415) 2018-01-23 15:58:36 +00:00
Miek Gieben
9575789c36
plugin/secondary: don't duplicate apex records (#1413)
See #1400 and the discussion in that bug.

Fixes #1400
2018-01-23 10:35:31 +00:00
Miek Gieben
85457cf50d
plugin/secondary: fix a bunch of things and tests (#1406)
Fix the error handling. Log when we have an error during any of the
transfer state. And if there isn't an error transfer the zones.

Also fix the tests in test/ so we, at least, check the initial transfer.

Update the docs to show more about how errors are handled.

Ref #1400
2018-01-23 10:35:10 +00:00
Paul Greenberg
7d371edb2d plugin/rewrite: add response rewrite docs (#1414) 2018-01-22 22:01:13 -05:00
Paul Greenberg
258c163bb0 feature: plugin/rewrite: rewrite ANSWER SECTION (#1318)
Resolves: #1313
2018-01-18 10:41:14 -05:00
Miek Gieben
cb3190bab1
plugin/dnssec: fix blacklies for NXDOMAIN (#1399)
* plugin/dnssec: filter bitmap also for NXDOMAIN responses

We change nxdomain to nodata, so at the point when we receive the
reply it can be nxdomain or nodata. In both cases we should filter the
nsec bitmap.

Change the code and add explicit tests for this.

* More tests
2018-01-18 13:07:23 +00:00
Miek Gieben
c39e5cd014
plugin/health: add lameduck mode (#1379)
* plugin/health: add lameduck mode

Add a way to configure lameduck more, i.e. set health to false, stop
polling plugins. Then wait for a duration before shutting down. As the
health middleware is configured early on in the plugin list, it will
hold up all other shutdown, meaning we still answer queries.

* Add New

* More tests

* golint

* remove confusing text
2018-01-18 10:40:09 +00:00
Miek Gieben
318bab7795
plugin/dnssec: check validityperiod of RRSIGs (#1385)
* plugin/dnssec: check validityperiod of RRSIGs

Somehow we missed implementing this. If a sig a retrieved from the
cache, but not valid anymore, regenerate it instead of server invalid
signatures.

Fixes #1378

* drop from cache after 3/4 validity

* six days means 6 days
2018-01-18 10:39:22 +00:00
Tobias Schmidt
dd9fc8962c plugin/cache: Fix prefetching issues (#1363)
* Improve plugin/cache metrics

* Add coredns_cache_prefetch_total metric to track number of prefetches.
* Remove unnecessary Cache.get() call which would incorrectly increment
  cache counters.
* Initialize all counters and gauges at zero.

* Allow prefetching of a single request per ttl

The original implementation didn't allow prefetching queries which are
only requested once during the duration of a TTL. The minimum amount of
queries which had to be seen was therefore capped at 2.

This change also implements a real prefetch test. The existing test was
a noop and always passed regardless of any prefetch implementation.

* Fix prefetching for items with a short TTL

The default prefetch threshold (percentage) is 10% of the lifetime of a
cache item. With the previous implementation, this disabled prefetching
for all items with a TTL < 10s (the resulting percentage would be 0, at
which point a cached item is already discarded).

This change uses a time based threshold calculation and ensures that
a prefetch is triggered at a TTL of 1 at the latest.

* Fix wrong duration reporting of cached responses

The logging and metrics plugins (among others) included the duration of
a cache prefetch in the request latency of client request. This change
fixes this wrong reporting and executes the prefetch request in a
goroutine in the background.
2018-01-17 07:35:22 +00:00
Yong Tang
fe0767987e
Fix several typos (#1395)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-15 18:27:47 -08:00
Yong Tang
584dd87c70
Add route53 plugin (#1390)
* Update vendor

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add route53 plugin

This fix adds route53 plugin so that it is possible to
query route53 record through CoreDNS.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-15 09:59:29 -08:00
Tobias Schmidt
d699b89063 Fix SOA examples in plugin/template README (#1391)
SOA records are returned in the authority section, not as answer.
2018-01-15 13:55:10 +00:00
Miek Gieben
05ebfaa36a
plugin/log: add the super useful msg ID into the logs (#1387) 2018-01-12 18:03:47 +00:00
cricketliu
a952c07453 Update README.md (#1381)
Minor textual cleanup.
2018-01-11 18:19:16 +00:00
Tobias Schmidt
f1b280de53 Remove TTL ceiling at 5s in plugin/cache (#1380)
The cache plugin always returned a minimum TTL of 5 seconds, regardless
of the actual TTL of the records. A cache is not authoritative for the
record TTL and should not extend it.
2018-01-11 17:06:49 +00:00
cricketliu
5ac8ab4b45 Update README.md (#1376)
Minor textual cleanup.
2018-01-11 07:32:06 +00:00
cricketliu
3e298d2396 Update README.md (#1375)
More minor textual fixes.
2018-01-11 07:31:52 +00:00
cricketliu
655231a599 Update README.md (#1374)
Fixing a couple of small textual problems.
2018-01-11 07:31:34 +00:00
cricketliu
d15746596f Update README.md (#1373)
Just some textual cleanup:  A few misspellings and a few clarifications.
2018-01-10 15:08:08 -08:00
Miek Gieben
b7476d0217
Doc (#1369)
* Constent atx headers

* Regen manual pages
2018-01-10 11:45:12 +00:00
Miek Gieben
48059a6c3e
Overloaded (#1364)
* plugin/health: add 'overloaded metrics'

Query our on health endpoint and record (and export as a metric) the
time it takes. The Get has a 5s timeout, that, when reached, will set
the metric duration to 5s. The actually call "I'm I overloaded" is left
to an external entity.

* README

* golint and govet

* and the tests
2018-01-10 11:41:22 +00:00
Miek Gieben
cced1a4c12
pkg/fall: make Zero and Root vars not funcs (#1367)
These can be just vars. Think that was intended as well.
2018-01-09 22:29:19 +00:00
Miek Gieben
a19ea63d3a
plugin/template: small tweaks (#1366)
Small README updates, and fallthrough fixes (using less code)
2018-01-09 21:48:32 +00:00
Rene Treffer
0091e1c9dc Align plugin/template usage and syntax with other plugins (#1360)
* Align plugin/template usage and syntax with other plugins

* Use new fallthrough logic in plugin/template

* Use zone name normalization for plugin/template

* Test fallthrough parsing in plugin/template

* Rework scoping of match checks

Most matches are not plugin global but per template. The plugin does only a
very rough check while detailed checks are done per-template.

Per template checks include:
- Zones
- Class/Type
- Regex
- Fallthrough

* Remove trailing `.` from fully qualified domain names

* Register template metrics with zone/class/type instead of regex

* Remove trailing fqdn dot from multiple testcases
2018-01-09 21:30:58 +00:00
Miek Gieben
a7590897fb
plugin/proxy: max the number of upstreams (#1359)
* plugin/proxy: max the number of upstreams

Put a max of 15 on the number of upstreams.
2018-01-08 15:03:42 +00:00
Miek Gieben
dd37627e8e
plugin/template: README tweaks (#1361)
* plugin/template: README tweaks

* Go gen it
2018-01-08 13:13:25 +00:00
Rene Treffer
a322d90f6f plugin/template (#1298)
* Add a template plugin

The template plugin matches the incoming query by class, type and regex
and templates a response with go templates.

* Fix go style errors

* Fix template README example

* Fix corefile example in plugin/template

* Clarify plugin/template/README.md

Add more details and external links where needed.

* Fix code issues in plugin/template

* Add template metrics

* Add section and template to template plugin metrics

* Fix style / remove extra newline on go imports

* Fix typo in plugin/template/README.md

* Update README.md

I've change the format a bit in a PR that I merged yesterday.

* Add authority section to plugin/template

* Fix naming of incoming query name in plugin/template/README.md

* Fix doc syntax in plugin/template/README.md

* Add authority section to plugin/template/README.md config overview

* Add metric labels to plugin/template/README.md metrics section

* Use request.Request to pass state to the template matcher
2018-01-08 10:52:25 +00:00
John Belamaric
c59f5f6e86
Simplify plugin/pkg/fall (#1358)
* Simplify plugin/pkg/fall

* Remove unused import

* Fix fall_test

* Get fall coverage to 100% just because

* gofmt. sigh.
2018-01-07 14:51:32 -05:00
Miek Gieben
c6febe6250
Add pkg/fall for Fallthrough (#1355)
* Add pkg/fall for Fallthrough

Move this into it's own package to facilitate tests. Important bug
was fixed: make the names fully qualified.

Add fall package to hosts, reverse, etcd, and fix kubernetes and any
tests. The k8s tests are still as-is, might need a future cleanup.
2018-01-07 16:32:59 +00:00
John Belamaric
84ebbbc722
kubernetes: Add zone filtering to fallthrough (#1353)
* Add zone filtering to fallthrough

* Doh. gofmt

* Update documentation
2018-01-06 14:52:09 -05:00
Miek Gieben
75a8a17da4
plugin/kubernetes: fix pod insecure mode (#1354)
Fixes #1331
2018-01-06 15:56:54 +00:00