Commit graph

1208 commits

Author SHA1 Message Date
Miek Gieben
a91cd9c428
plugin/kubernetes: add explicit non-existing ns check (#1350)
We already do the right thing here, but add a test none-the-less.
2018-01-05 17:53:26 +00:00
Miek Gieben
f62189372a
plugin/kubernetes: partial fix for crazy pod queries (#1349)
This is probably the first in a series to fix "crazy" pod queries.
If the namespace doesn't exist return NXDOMAIN.

It might be worth extending this 1:1 to findServices as well.
2018-01-05 17:48:08 +00:00
Miek Gieben
58221f55db
Manual pages (#1346)
* Add manual pages

Generate manual pages from the README and extend README with Name and
Description sections.

The generation requires 'ronn' which may not be available. Just check in
all generated manual pages.
2018-01-04 12:53:07 +00:00
Miek Gieben
311af9314d
plugin/dnssec: implement shotgun from CloudFlare (#1305)
* plugin/dnssec: implement shotgun from CloudFlare

Put a whole bunch of types in the NSEC bitmap and remove the one that's
being asked for.

Add more records for queries to the apex, SOA, DNSKEY, MX.
2018-01-03 11:11:56 +00:00
Yong Tang
7fe5b0bb1f Update k8s client-go to v6.0.0 (#1340)
* Update k8s client-go to v6.0.0

This fix updates k8s client-go to v6.0.0 as CoreDNS is supported
in 1.9 and v6.0.0 is the recommended version.

There are quite some massive changes that need to be made:
1. k8s.io/client-go/pkg/api/v1 has been changed to k8s.io/api/v1 (repo changed from `client-go` to `api`)
2. kubernetes.Clientset adds one extra layer, so that `kubernetes.Clientset.Services()` and like has been changed to `kubernetes.Clientset.CoreV1().Services()`

Also, we have to stick with specific commits of `k8s.io/apimachinery` and the newly introduced `k8s.io/api`
because go dep still could not figure out the right version to fetch.

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

* Update vendor with `dep ensure --update` and `dep prune`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-03 11:11:28 +00:00
Miek Gieben
90dd4bbd45
metrics: correctly register all metrics (#1335)
After initial startup, see if prometheus is loaded and if so, register
our metrics with it.
Stop doing the init() func and just use the sync.Once so we don't double
registrer our metrics.
2017-12-27 15:48:14 +00:00
Miek Gieben
99047aee9b
plugin/metrics: convience MustRegister function (#1332)
This leave most of the code intact, but we need to stop vendoring
prometheus, because, again, plugins what want to use it. Not vendoring
prometheus makes my forward metrics show up again. Code looks bit
convoluted, but works:

~~~
	c.OnStartup(func() error {
		once.Do(func() {
			m := dnsserver.GetConfig(c).Handler("prometheus")
			if m == nil {
				return
			}
			if x, ok := m.(*metrics.Metrics); ok {
				x.MustRegister(RequestCount)
				x.MustRegister(RcodeCount)
				x.MustRegister(RequestDuration)
				x.MustRegister(HealthcheckFailureCount)
				x.MustRegister(SocketGauge)
			}
		})
	})
~~~
2017-12-27 14:14:53 +00:00
Miek Gieben
1f81d154ed
dnstest: add multirecorder (#1326)
* dnstest: add multirecorder

This adds a new recorder that captures all messages written to it. This
can be useful when, for instance, testing AXFR which can write muliple
messages back to the client.

* docs
2017-12-22 08:54:27 +00:00
Miek Gieben
a8ba24fff9 plugin/proxy: for duration metrics (#1323)
The README.md was updated by not the actual metric.

Fixes #1321
2017-12-20 18:25:43 -05:00
Yong Tang
ba4e77672c Fix a couple of typos (#1316)
`hanlder` -> `handler`

`bounderies` -> `boundaries`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-12-15 21:31:57 +00:00
Brad Beam
cee6f60ab8 Adding additional records for test cases (#1304) 2017-12-14 14:14:10 -05:00
Paul Greenberg
3125381f2d plugin/rewrite: fix flow control logic for all rule types (#1308)
Resolves: #1307
2017-12-14 13:25:36 -05:00
James Hartig
671d170619 plugin/metrics: Switch to using promhttp instead of deprecated Handler (#1312)
prometheus.Handler is deprecated according to the godoc for the package so
instead we're using promhttp.

Additionally, we are exposing the Registry that metrics is using so other
plugins that are not inside of coredns can read the registry. Otherwise, if
we kept using the Default one, there's no way to access that from outside
of the coredns repo since it is vendored.
2017-12-14 18:19:03 +00:00
James Hartig
1919913c98
plugin/metrics: Added New func (#1309)
If external plugins wanted to extend metrics there was no way since
zoneNames couldn't be initialized. Now plugins can call New to get an
instance of Metrics that they can extend.
2017-12-13 16:59:10 -05:00
Frederic Hemberger
2e2e5e1bec plugins/dnssec: Fix hostnames in README (#1310) 2017-12-13 21:36:35 +00:00
Paul Greenberg
d35f2c73ec plugin/rewrite: regular expression and substring match/replace (#1296) (#1297) 2017-12-13 11:31:19 -05:00
Brad Beam
556a289d9a Moving TransferParse from file to its own package (#1286)
* Moving TransferParse from file to its own package

* Adding tests for parse
2017-12-13 11:18:08 -05:00
James Hartig
a469a17cdf Instead of hardcoding plugin lists in autopath/health, use interfaces. (#1306)
Switched health and autopath plugin to allow any plugins to be used instead
of a hardcoded list. I did not switch federation over since it wasn't
obvious that anything other than kubernetes could be used with it.

Fixes #1291
2017-12-12 20:40:30 +00:00
Miek Gieben
5a7e440476
plugin/file: fix crash (#1301)
When z.Tree.Prev returns zero we should break out of this loop, not
use elem as if nothing has happened.

Can be triggered by sending edns0 to unsigned zone.
2017-12-11 14:32:51 +00:00
Miek Gieben
27da0eba04
plugin/file: Fix response for qtype=DS (#1300)
DS is peculiar and needs some special cases to do the right things.
For a direct query return the DS, but if we're hitting below the
delegation return the NS+DS in a delegation response.
2017-12-11 14:17:41 +00:00
Miek Gieben
6cd0050c09
file/plugin: if there is a delegation use that (#1299)
Don't put NS records in the answer section; if we see it is delegated
we should put the records in the AUTHORITY section.

This removes a special case, which is good.
2017-12-11 13:22:19 +00:00
Miek Gieben
cf5418a015
plugin/nsid: Small doc cleanup (#1293)
add an example and some typos fixed.
2017-12-09 09:37:02 +00:00
Brad Beam
850a024905 Changing switch to compare on constants versus strings (#1285) 2017-12-07 22:31:13 -06:00
Brad Beam
986512892d Consolidating const declarations (#1287) 2017-12-07 23:04:02 +00:00
Miek Gieben
0e8ceea1d6
plugin/proxy: skip hc for https_google (#1272)
If protocol is https_google we do the health checks wrong, i.e. we're healthchecking the wrong
endpoint, hence the health check code below should not be executed. See issue #1202.
This is an ugly hack and the thing requires a rethink. Possibly in conjunction with moving
to the *forward* plugin.
2017-12-07 22:25:05 +00:00
Ruslan Drozhdzh
45ef657d36 Increase performance of Dnstap plugin (#1280)
- added dnstapEncoder object which incapsulates marshalling of dnstap
   messages to protobuf and writing data to connection

 - dnstapEncoder writes data directly to connection object. It doesn't
   use the framestream's "write" method, because it writes data to
   intermediate buffer (bufio.Writer) which leads to unnecessary
   data copying and drops the performance

 - dnstapEncoder reuses a preallocated buffer for marshalling dnstap
   messages. Many messages are added to the same buffer. They are
   separated with a "frame length" 4-byte values, so the buffer content
   is writen to connection object in the format compatible with
   framestream library

 - added test which guarantees that dnstapEncoder output is the same
   as framestream Encoder output

 - the performance increase is about 50% in (dio *dnstapIO) serve() method
   of dnstap plugin. The overall coredns performance increase is about 10%
   in the following configuration:

   .:1053 {
       erratic {
           drop 0
           truncate 0
           delay 0
       }
       dnstap tcp://127.0.0.1:6000 full
       errors stdout
   }

   tested with dnsperf tool
2017-12-06 10:36:04 +00:00
Rene Treffer
98632cd4a6 Fix time bucketing of response time (#1274) 2017-12-05 18:51:55 +00:00
Yong Tang
0baab055df Update etcd/README.md for multiple endpoints, and add additional test cases (#1277)
This fix tries to address the issue raised in 1275 to clarify
the syntax for multiple endpoints specification.

This fix also adds additional test cases to demo the usage.

This fix fixes 1275.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-12-05 18:02:37 +00:00
Yong Tang
5bafa6d97f Update docs with missing ~ (#1276)
Looks like the last commit missed a `~` in the docs.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-12-04 16:49:04 +00:00
Yong Tang
b52c3418b2
Add NSID plugin support for CoreDNS (#1273)
* Add NSID plugin support for CoreDNS

This fix adds NSID plugin support for CoreDNS, as was proposed
in 1256.

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

* Add test cases for NSID plugin

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

* Generate code for NSID plugin

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

* Use hostname as the default (as with bind), and remove unneeded copy

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

* Add README.md

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-12-04 08:28:27 -08:00
Miek Gieben
7cc3b08f65
plugin/proxy: when HC fails increase fails (#1270)
When we failing the healthcheck we should increate the fails for this
host; which is the *bleeping* point of doing the HC in the first place.

Add the missing atomic.Adds.

Fixes #1247
2017-12-01 15:57:34 +00:00
Miek Gieben
0d103ff57c
plugin/proxy: add note about HC and google_https (#1269)
HC for google_https does not work because it does not HC the correct
set of IPs. Hard to solve in the current code - rather use forward as
the new impl. and leave this as legacy.

Remove superfluous println that we are refreshing the dns.google.com IP
address.
2017-12-01 13:21:18 +00:00
Uladzimir Trehubenka
861e2382c2 Added reconnect feature for dnstap plugin (#1267) 2017-12-01 11:16:14 +00:00
Miek Gieben
917965fa86
metrics: use exponentional buckets (#1261)
* metrics: use exponentional buckets

See  https://github.com/kubernetes/dns/pull/168
2017-12-01 11:15:05 +00:00
Miek Gieben
f96555476e
plugin/dnssec: Drop inserting DS records on delegation (#1266)
See #1211 for disuccsion; current code is probably the wrong thing to
do; rethink if we need/want this. Comment out the code for now.
2017-12-01 11:14:39 +00:00
Miek Gieben
e9699c42b7
plugin/rewrite: don't set or use ecs.DraftOption (#1262)
* plugin/rewrite: don't set or use ecs.DraftOption

Don't know why we are accessing this and explicitally setting it to
False (the default).
Any kill with fire - makes the build, build again.

* remove this
2017-11-28 14:03:20 +00:00
Uladzimir Trehubenka
6d6e1357b9 Dnstap plugin refactoring (#1257) 2017-11-27 21:36:14 +00:00
Ben Kochie
06006fac56 Update timing histograms (#1253)
* Use seconds for bucketing.
* Add template for high accuracy timing buckets to avoid copy-pasta.
2017-11-27 21:34:26 +00:00
Miek Gieben
9d52b5acb9
plugin/etcd: drop inflight (#1249)
Use caching, just ask etcd for every query. This also improves
throughput because the single lock in inflght is bypassed.
2017-11-26 17:21:24 +00:00
Chris O'Haver
614ed4c80d fix external service type check (#1246) 2017-11-22 11:17:27 +00:00
Chris O'Haver
6e4520ce96 plugin/k8s: ipv6 UT for endpoint (#1243)
* ipv6 UT for endpoint

* tweak
2017-11-16 16:24:49 -05:00
Miek Gieben
70a5a098c1
plugin/kubernetes: Fix reverse TTL response (#1240)
Remove most 303 TTLs (those get skipped by the test) and use 5, which is
the default for all tests.
2017-11-15 15:04:17 +00:00
Miek Gieben
621dd36f6d
plugin/kubernetes: set TTL on pod responses (#1239)
The TTL was still zero, instead it should adhere to the k.ttl setting.
Change this and update tests to match.
2017-11-15 14:06:37 +00:00
Chris O'Haver
99dd8f99f3 plugin/k8s: clean up and add some ipv6 tests (#1237)
* clean up and add some ipv6 tests

* aaaa endpoint

* gofmt
2017-11-15 07:16:04 +00:00
Miek Gieben
c37bf56b1e
plugin/kubernetes: correctly set NODATA for ns (#1229)
* plugin/kubernetes: Add GetNamespaceByName

A bare or wildcard query for just the namespace should return NODATA,
not NXDOMAIN, otherwise we deny the entirety of the names under the
namespace.

Add test to check for this in pod verified mode.

* Review

More comments and move namespace code to namespace.go
2017-11-13 21:51:51 +00:00
Miek Gieben
7c7a233b83 this too 2017-11-13 16:15:10 +00:00
Miek Gieben
d0c7a87b69 Merge branch 'master' of github.com:coredns/coredns 2017-11-13 16:08:43 +00:00
Miek Gieben
42504332ae plugin/rewrite: lowercase error
super small cleanup; smaller case return errors.
2017-11-13 16:08:06 +00:00
Andy Goldstein
f4f1736329 plugin/kubernetes: check err in getClientConfig (#1230)
Check the error returned by clientConfig.ClientConfig() before trying to
set cc.ContentType.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2017-11-13 16:01:57 +00:00
Miek Gieben
52b49f4838
plugin/health: implement dyn health checks (#1214)
Implement health.Healther in erratic and kubernetes plugin. The
kubernetes' healtcheck is only performed on startup - i.e. turn
healthy after the initial loading.

Erratic follow the drop count: every query%drop turns the healthcheck
unhealthy.

Fixes: #985
2017-11-13 09:52:40 +00:00