Commit Graph

1335 Commits

Author SHA1 Message Date
Miek Gieben
c0590e4ec4 plugin/etcd: small refactor (#1749)
* plugin/etcd: small refactor

I think this function can be smaller.

* and make it compile
2018-04-28 10:03:35 +01:00
Miek Gieben
82d3195f2f pkg/log usage in coremain as well (#1751) 2018-04-27 21:50:24 +01:00
Miek Gieben
bfc647d4ed Cache metrics server (#1746)
* plugin/cache: per server metrics

Use per server metrics in the cache plugin as well. This required
some plumbing changes. Also use request.Request more.

* fix cherry-pick
2018-04-27 19:37:49 +01:00
Miek Gieben
85f549b529 plugin/dnssec: add per server metrics (#1743)
* plugin/dnssec: add per server metrics

final plugin.

Fixes #1696 #1492 #1189

* Move cache cap into handler so we can access the server label

* Remove cache-capacity from it entirely
2018-04-27 19:37:31 +01:00
Miek Gieben
2a28efa877 plugin/template: update metrics to include server (#1731)
Add server label to the metrics and update the README.
2018-04-27 19:37:12 +01:00
Mario Kleinsasser
13b1f5469a Fix #1685 (#1700)
Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>

Create separate function for zone check

Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>

Add tests for zone A records

Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>

Remove pointer from checkZoneForRecord func signature, Add documentation

Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>

Change apex to zone, Update readme information, Add additional tests

Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>

Change zone to apex

Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>

Change readme to reflect apex change

Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>

Correct code comment

Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>

Correct string join for apex.dns

Signed-off-by: Mario Kleinsasser <mario.kleinsasser@gmail.com>
2018-04-27 19:36:58 +01:00
John Belamaric
9d25b6d8b9 Update README.md (#1748) 2018-04-27 10:25:46 -04:00
John Belamaric
7ec92e055d Update README.md 2018-04-27 09:49:25 -04:00
Miek Gieben
f0f80ed739 plugin/forward: clarify relation with proxy (#1747)
some other small bits as well.
2018-04-27 14:24:58 +01:00
Chris O'Haver
47b2b10209 plugin/rewrite: handle continue in response rewrite (#1740)
* handle continue in response rewrite

* add test
2018-04-27 07:05:44 +01:00
Miek Gieben
3236464223 plugin/kubernetes: document tranfer (#1745)
Fixes #1720
2018-04-26 21:29:29 +01:00
Miek Gieben
3ce4fc8fe4 Do ' go vet' after we have fetch the repos (#1744)
Do ' go vet' after we have fetched the repos
2018-04-26 13:03:31 +01:00
Miek Gieben
270da82995 plugin/forward: move Dial goroutine out (#1738)
Rework the TestProxyClose - close the proxy in the *same* goroutine
as where we started it. Close channels as long as we don't get dataraces
(this may need another fix).

Move the Dial goroutine out of the connManager - this simplifies things
*and* makes another goroutine go away and removes the need for connErr
channels - can now just be dns.Conn.

Also:

Revert "plugin/forward: gracefull stop (#1701)"
This reverts commit 135377bf77.

Revert "rework TestProxyClose (#1735)"
This reverts commit 9e8893a0b5.
2018-04-26 09:34:58 +01:00
Miek Gieben
4c7ae4ea95 plugin/health: update README (#1739)
* plugin/health: update README

Make more clear in the readme that health is limited to 1 server.

Fixes #1722

* rephrase and remove ~~~ corefile because it will fail
2018-04-26 08:44:33 +01:00
Cem Türker
45afa4f426 Update gitignore for intellj .idea file. (#1742) 2018-04-26 08:42:45 +01:00
Chris O'Haver
5e06687ee5 plugin/rewrite: tweak parse error messaging, add tests (#1737)
* tweak parse error messaging, add tests

* looser err msg checking
2018-04-25 20:48:32 +01:00
Ruslan Drozhdzh
9e8893a0b5 rework TestProxyClose (#1735) 2018-04-25 19:15:49 +01:00
Miek Gieben
5c3e436d71 plugin/autopath: per server metrics (#1730)
Implement per server metrics in autopath; also don't export the metric.

Updated readme as well.
2018-04-25 11:43:56 -04:00
Miek Gieben
d3f2d4a291 core: remove HostAddresses() (#1728)
* core: remove HostAddresses()

config.HostAddresses() is a weird function that gathers
some data from the server and returns a string.

It is *only* used the trace plugin, to figure out what
server starts the trace.

Looks to be better to fit in the with metrics.WithServer label
on the trace itself to show which server handled the trace.

Remove HostAddresses() and cleanup trace a small bit.:w

* lint
2018-04-25 15:27:25 +01:00
Miek Gieben
7a507e34ca deprecate some stuff (#1732)
https_google and reverse will be removed in 2 releases. Add warnings.

We will move reverse to coredns/reverse and list it as external after
this switch.

See #1713
2018-04-25 12:38:04 +01:00
Miek Gieben
5e6114b797 plugin/pkg/uniq: add (#1733)
Spin this out the metrics package so we can use it in the health
one of well to fix some reload bugs.
2018-04-25 11:45:09 +01:00
Miek Gieben
ce084012df plugin/forward: fix TLS setup (#1714)
* plugin/forward: fix TLS setup

Way smaller PR than #1679. Fixes same thing.

* remove println

* put overwritten test back

* context

* update tests
2018-04-24 18:18:26 +01:00
Miek Gieben
f529a2771f plugin/forward: close channels when connManager returns (#1727)
Close a bunch of channels, also change the test to just use a for loop
with a counter.
2018-04-24 17:09:15 +01:00
Miek Gieben
d49194623f plugin/forward: remove lenc and lencOut channels (#1726)
Remove these 2 channels, as they were only used in testing and
complicate things if we want to do a clean stop()

Less is more.
2018-04-24 16:10:31 +01:00
Miek Gieben
b9ddb061e1 dockerignore: ignore .git (#1723)
also ignore build/ and release/ as they may be left over from releasing
coredns.

Sending build context to Docker daemon  490.9MB ->
 Sending build context to Docker daemon  98.82kB
2018-04-24 09:23:50 +01:00
Miek Gieben
c9b5cedbe9 Presubmit (#1719)
* build: add presubmits

We didn't have a way to encode presubmit; with this hack we can just
run a bunch of script on the build; this allows us to automatically
capture things like using the wrong context and maybe other fluff.

This allows us to cut down on code reviews and just have the build fail.

* hook it up

* put presubmit in checks; so we do it for tests as well

* Add explicit exit 1 if things fails
2018-04-23 08:45:49 -07:00
Miek Gieben
582f91f3f3 Release 1.1.2 v1.1.2 2018-04-23 13:44:33 +01:00
Miek Gieben
eb7c3ad137 Build manual docs (#1721)
Slight tweak in the forward readme, as sublist don't work well to
generate these.
2018-04-23 12:47:32 +01:00
Miek Gieben
12b2ff9740 Use logging (#1718)
* update docs

* plugins: use plugin specific logging

Hooking up pkg/log also changed NewWithPlugin to just take a string
instead of a plugin.Handler as that is more flexible and for instance
the Root "plugin" doesn't implement it fully.

Same logging from the reload plugin:

.:1043
2018/04/22 08:56:37 [INFO] CoreDNS-1.1.1
2018/04/22 08:56:37 [INFO] linux/amd64, go1.10.1,
CoreDNS-1.1.1
linux/amd64, go1.10.1,
2018/04/22 08:56:37 [INFO] plugin/reload: Running configuration MD5 = ec4c9c55cd19759ea1c46b8c45742b06
2018/04/22 08:56:54 [INFO] Reloading
2018/04/22 08:56:54 [INFO] plugin/reload: Running configuration MD5 = 9e2bfdd85bdc9cceb740ba9c80f34c1a
2018/04/22 08:56:54 [INFO] Reloading complete

* update docs

* better doc
2018-04-22 21:40:33 +01:00
Miek Gieben
0930eb8beb all: fix plugin import ordering (#1717)
Got a bit messed up with stb lib "context" usage.
2018-04-22 08:34:35 +01:00
Miek Gieben
69a956f052 plugin/pkg/log: add plugin logging (#1716)
Add per plugin logging to make it explicit what is logging, if you
include this package under the name clog (coredns log), you can do the
following:

log := clog.NewWithPlugin{whoami{}} // e.g.

And then just log.Info(...); these will then include the plugin ala:
[INFO] plugin/whoami: stuff

So we only need to init the logger and then just use it.
2018-04-22 08:20:01 +01:00
Miek Gieben
a466bb6fc6 Export metrics in setup; so it also works after reload (#1715)
* brr; a sleep

* Shouldnt need a query
2018-04-21 18:59:35 +01:00
Miek Gieben
acbcad7b4e reload: use OnRestart (#1709)
* reload: use OnRestart

Close the listener on OnRestart for health and metrics so the default
setup function can setup the listener when the plugin is "starting up".

Lightly test with some SIGUSR1-ing. Also checked the reload plugin with
this, seems fine:

.com.:1043
.:1043
2018/04/20 15:01:25 [INFO] CoreDNS-1.1.1
2018/04/20 15:01:25 [INFO] linux/amd64, go1.10,
CoreDNS-1.1.1
linux/amd64, go1.10,
2018/04/20 15:01:25 [INFO] Running configuration MD5 = aa8b3f03946fb60546ca1f725d482714
2018/04/20 15:02:01 [INFO] Reloading
2018/04/20 15:02:01 [INFO] Running configuration MD5 = b34a96d99e01db4015a892212560155f
2018/04/20 15:02:01 [INFO] Reloading complete
^C2018/04/20 15:02:06 [INFO] SIGINT: Shutting down

With this corefile:
.com {
  proxy . 127.0.0.1:53
  prometheus :9054
  whoami
  reload
}

. {
  proxy . 127.0.0.1:53
  prometheus :9054
  whoami
  reload
}

The prometheus port was 9053, changed that to 54 so reload would pick it
up.

From a cursory look it seems this also fixes:
Fixes #1604 #1618 #1686 #1492

* At least make it test

* Use onfinalshutdown

* reload: add reload test

This test #1604 adn right now fails.

* Address review comments

* Add bug section explaining things a bit

* compile tests

* Fix tests

* fixes

* slightly less crazy

* try to make prometheus setup less confusing

* Use ephermal port for test

* Don't use the listener

* These are shared between goroutines, just use the boolean in the main
  structure.
* Fix text in the reload README,
* Set addr to TODO once stopping it
* Morph fturb's comment into test, to test reload and scrape health and
  metric endpoint
2018-04-21 17:43:02 +01:00
Ruslan Drozhdzh
135377bf77 plugin/forward: gracefull stop (#1701)
* plugin/forward: gracefull stop

 - stop connection manager only when no queries in progress

* minor improvement

* prevent healthcheck on stopped proxy

* revert closing channels

* use standard context
2018-04-20 17:47:46 +03:00
Miek Gieben
ad13d88346 plugin/health: clarify server label (#1707)
Health overloaded metrics does not carry the server label. Explain why.
2018-04-20 15:03:59 +01:00
Miek Gieben
8722336fff global: move to context (#1699)
* global: move to context

Move from golang.org/x/net/context to std lib's context.

Change done with:

for i in $(grep -l '/context' **/*.go); do sed -e 's|golang.org/x/net/context|context|' -i $i; echo $i; done
for i in **/*.go; do goimports -w $i; done

* drop from dns.pb.go as well
2018-04-20 11:01:06 +01:00
Miek Gieben
61726b3721 Run make -f Makefile.doc (#1705)
Remove trailing white space from proxy/README.md
2018-04-20 07:24:19 +01:00
Scott Donovan
19a1ef48f2 adding sequential policy to forward plugin (#1704)
* adding sequential policy to forward plugin

* making sequential an alias to first in proxy plugin
2018-04-20 07:07:58 +01:00
Miek Gieben
26d1432ae6 Update all plugins to use plugin/pkg/log (#1694)
* Update all plugins to use plugin/pkg/log

I wish this could have been done with sed. Alas manually changed all
callers to use the new plugin/pkg/log package.

* Error -> Info

* Add docs to debug plugin as well
2018-04-19 07:41:56 +01:00
Moto Ishizawa
2095eb7979 Add Z Lab to adopters list (#1695) 2018-04-19 07:20:51 +01:00
Miek Gieben
b4b65fbc18 pkg/log: ability for debug logs (#1689)
* pkg/log: ability for debug logs

When the debug plugin is enabled all log.Debug calls will print to
standard; if not there are a noop (almost).

The log package wraps some standard log functions as well, so just
replacing "log" with "plugin/pkg/log" should be enough to use this
package.

* docs

* Add docs

* lint

* Test fallthrough to log pkg as well

* simple package - up test coverage

* add other log levels as well

* update docs
2018-04-18 21:02:01 +01:00
Chris O'Haver
51e1442bd9 plugin/kubernetes: check for bare zone query (#1692)
* check for bare zone query

* check for bare type query
2018-04-18 12:12:28 -04:00
Chris O'Haver
9a7e487a5a Update README.md (#1690) 2018-04-18 15:17:14 +01:00
Miek Gieben
08443a9f00 plugin/metrics: add 'server' label (#1682)
* plugin/metrics: add 'server' label

This uses the new WithServer(ctx) to get the current server from the
context.

First in a larger refactor to make all plugins do this.

* compile

* compile

* lala test

* compile and test

* typos

* Dont duplicate the code
2018-04-18 09:42:20 +01:00
Miek Gieben
573ad62b77 plugin/forward: min and max for avgRTT (#1680)
* Move to readtimeout

* lets compile

* address comment

* comment from pr

* much smaller minimum
2018-04-16 14:51:49 -04:00
Miek Gieben
cd7928f180 make: default to default go path (#1681)
if GOPATH is not set use $HOME/go which is the current default in Go.

Fixes #1642
2018-04-15 09:14:18 -07:00
Miek Gieben
cff0c9fb4c plugin/forward: test TLS setup (#1677) 2018-04-13 17:02:54 +01:00
Miek Gieben
662edf6607 pkg/up: stop *all* goroutines (#1676)
Stop all goroutines after we get the stop signal.
2018-04-13 16:01:12 +01:00
Tobias Schmidt
e671e22e65 plugin/forward: Return original message on truncation (#1674)
With this change the original truncated message returned by requested
server is returned to the client, instead of returning an empty dummy
message with only the truncation bit set.
2018-04-12 20:17:05 +01:00
Miek Gieben
305ae9b9bc plugin/forward: check TC correctly on reply. (#1670)
* plugin/forward: check TC correctly on reply.

Add test for this.

* Add proxy test as well
2018-04-11 21:18:41 +01:00