Commit graph

120 commits

Author SHA1 Message Date
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
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