Commit graph

629 commits

Author SHA1 Message Date
Anshul Sharma
ad352cee88 plugin/reload: Add metrics (#2922)
* Issue 2920
- Add failed reload counter metrics

* typo fix

* Requested Changes
2019-06-26 07:38:46 +01:00
Miek Gieben
cd176f859b Run gofmt -s and golint on the codebase (#2918)
* Run gofmt -s and golint on the codebase

Run golint and fix everythign it flagged (except the context arg
ordering), mostly edits in the rewrite plugin.

Signed-off-by: Miek Gieben <miek@miek.nl>

* ... and ofcourse the test as well

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-06-25 15:00:33 +08:00
Chris O'Haver
b94c85a0db Update README.md (#2896) 2019-06-17 20:46:02 +01:00
Chris O'Haver
1cb44f0bfd Update plugin.go (#2894) 2019-06-17 20:01:06 +01:00
Miek Gieben
8848792e40
plugin/file: document using an explicit origin (#2893)
* plugin/file: document using an explicit origin

See #2880

Signed-off-by: Miek Gieben <miek@miek.nl>

* Code review comments

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-06-17 19:47:07 +01:00
An Xiao
c432f894b2 Rename bind_test.go to setup_test.go (#2891)
Signed-off-by: Xiao An <hac@zju.edu.cn>
2019-06-17 13:20:33 +01:00
An Xiao
c1d7c2e69b Raise error if regexp and template are not specified together (#2884)
Signed-off-by: Xiao An <hac@zju.edu.cn>
2019-06-13 12:07:41 +01:00
Miek Gieben
481dea50ad
plugin/cache: remove item.Autoritative (#2885)
* plugin/cache: remove item.Autoritative

Confuses clients if not set; remove it.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Add extra comments on why we do this

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-06-13 10:36:47 +01:00
An Xiao
27ca097df4 Fix a typo in the document of plugin file (#2882) 2019-06-11 16:11:42 -04:00
Yong Tang
f13482f4d1 Follow up on PR 2868 (#2877)
This fix is a follow up on comment https://github.com/coredns/coredns/pull/2868#discussion_r291609761

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-06-10 10:02:02 +01:00
Yong Tang
60f483e98b Fix lowercase presummit (#2876)
While running make encountered the following error:
```
$ docker run -i -t --rm -v $PWD:/v --net=host -w /v golang:1.12 make
...
...
** presubmit/test-lowercase
plugin/kubernetes/metadata_test.go:			t.Errorf("case %d expected metadata %v and got %v", i, tc.Md, md)
** presubmit/test-lowercase: please start with an upper case letter when using t.Error*()
Makefile:62: recipe for target 'presubmit' failed
make: *** [presubmit] Error 1
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-06-10 07:35:07 +01:00
Anshul Sharma
74303a985c Fix Datadog tracer (#2868)
- Fixes #2862
2019-06-09 13:44:19 -07:00
John Belamaric
ffcd2f61cf Publish metadata from kubernetes plugin (#2829)
* Publish metadata from kubernetes plugin

* stickler fix

* Add a couple tests

* Add metadata section to README

* Update plugin/kubernetes/README.md

Co-Authored-By: Chris O'Haver <cohaver@infoblox.com>

* Address nit
2019-06-09 08:10:57 +01:00
Miek Gieben
a1c97f82a6
plugin/ready: fix starts and restarts (#2814)
Add OnRestartFailed to the ready plugin and some various cleanups.

Document slightly better how things are supposed to work with multiple
`ready`'s in the multiple Server Blocks.

All manually tested with this Corefile:
~~~
. {
    log
    ready
}

example.org {
    log
    chaos
    ready
}
~~~
And then `kill -SIGUSR1` and curling the ready endpoint. This works
well, the FailedReload is triggered by adding a syntax error in the
Corefile.

See #2659

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-06-09 08:10:15 +01:00
Chris O'Haver
bd83f74deb remove unused functions (#2873) 2019-06-09 08:09:55 +01:00
Miek Gieben
458e778113
Revert "be sure to close connection after completion of xfr out. (#2866)" (#2872)
This reverts commit a657e1f661.
2019-06-07 15:29:42 +01:00
JINMEI Tatuya
a657e1f661 be sure to close connection after completion of xfr out. (#2866)
otherwise the connection and associated socket stay in the CLOSE_WAIT
state unless/until golang runtime performs GC.
2019-06-05 07:21:59 +01:00
Francois Tur
d3e2ef73b8 stepdown from CoreDNS maintainer (#2861) 2019-06-03 16:21:05 -04:00
Chris O'Haver
e1d0b63e3f allow an empty response (#2855) 2019-06-01 08:40:12 +01:00
Miek Gieben
3b3fb6f583
plugin/kubernetes: skip deleting pods (#2853)
Don't add pods to our internal cache that are being deleted. This saves
a field in the struct as well.

Add (extra) comments about adding fields to the
object/{Pod,Service,Endpoint} structs.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-06-01 08:39:52 +01:00
Cricket Liu
adc021d6ff Update README.md (#2856)
General syntactic cleanup.
2019-05-31 15:42:47 -07:00
JINMEI Tatuya
a6d9adbf4a make sure client CA and auth type are set if CA is explicitly specified. (#2825)
* make sure client CA and auth type are set if CA is explicitly specified.

added some simple tests to confirm the effect.

* test certificates (forgot to add them in the previous commit)

* made client auth policy configurable with new client_auth option.

README has been updated accordingly.

* fix editorial in README
2019-05-31 09:30:15 -07:00
Chris O'Haver
5565ca1c03 kubernetes: bump to client-go 11.0.0 (#2854)
* client-go 11.0.0

* Core moved to CoreV1
2019-05-31 08:01:48 -07:00
Andras Spitzer
7dde3f3958 Fix for #2842, instead of returning the first Pod, return the one whi… (#2846)
* Fix for #2842, instead of returning the first Pod, return the one which is Running

* a more memory efficient version of the fix, string -> bool

* fix with no extra fields in struct, return nil at Pod conversion if Pod is not Running

* let Kuberneretes filter for Running Pods using FieldSelector

* filter for Pods that are Running and Pending (implicit)
2019-05-29 08:06:45 +01:00
Miek Gieben
a84413bd07
pkg/log: fix data race on d (#2698)
* pkg/log: fix data race on d

Wrap d in a mutex to prevent data race. This makes is slower, but this
is a debugging aid anyway. It's not used normally.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix tests compilation

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix test compile

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-23 21:02:30 +01:00
Miek Gieben
118b0c9408
plugin/metrcs: fix datarace on listeners (#2835)
This fixes a data race on the listener(s) that get started in the
metrics plugins.

It also restore pkg/uniq to its former glory and removes and state being
carried in there; this means for metrics that registry.go was to
replicate that behavior *with* locking (as pkg/uniq doesn't do, or need
that).

Also renamed uniqAddr to just u, to make it slightly shorter.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-18 18:34:46 +01:00
Miek Gieben
d41e9ff7b7
pkg/log: reset the buffer in the tests (#2828)
Reset the buf otherwise we're not checking the new value.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-18 09:08:34 +01:00
Miek Gieben
2ef55f805e plugin/metrics: fix failed reload (#2816)
Fix metrics endpoint on a failed reload, follows the same lines as the
previous PRs, see for e.g. 076b8d4f. Test with a Corefile with 2 server
blocks and metrics enabled and then introducing a syntax error:

~~~
[ERROR] Restart failed: Corefile:5 - Error during parsing: Unknown directive 'jfkdjk'
[ERROR] SIGUSR1: starting with listener file descriptors: Corefile:5 - Error during parsing: Unknown directive 'jfkdjk'
~~~

And then curl-ing the metrics endpoint.

See #2659 and as this is the last one.

Fixes: #2659

Getting this all right turns out to be tricky, also it's not easy
testable which is something I should fix.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-13 04:26:05 -07:00
Chris O'Haver
c147e20373 make ignore empty work with ext svc types (#2823) 2019-05-07 17:31:50 -07:00
Yong Tang
6e1c57acfa Rename middleware -> plugin in comment (#2818)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-05-05 17:31:55 +00:00
Miek Gieben
fd165e94d5
plugin/autopath docs: remove last use of middleware (#2817)
This has somehow survived; the docs still used Middleware instead of
Plugins.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-05 18:02:59 +01:00
Miek Gieben
076b8d4fba plugin/health: add OnRestartFailed (#2812)
Add OnReStartFailed which makes the health plugin stay up if the
Corefile is corrupt and we revert to the previous version.

Also needs a fix for the channel handling

See #2659

Testing it will log the following when restarting with a corrupted
Corefile

~~~
2019-05-04T18:01:59.431Z [INFO] linux/amd64, go1.12.4,
CoreDNS-1.5.0
linux/amd64, go1.12.4,
[INFO] SIGUSR1: Reloading
[INFO] Reloading
[ERROR] Restart failed: Corefile:5 - Error during parsing: Unknown directive 'bdhfhdhj'
[ERROR] SIGUSR1: starting with listener file descriptors: Corefile:5 - Error during parsing: Unknown directive 'bdhfhdhj'
~~~

After which the curl still works.

This also needed a change to reset the channel used for the metrics
go-routine which gets closed on shutdown, otherwise you'll see:

~~~
^C[INFO] SIGINT: Shutting down
panic: close of closed channel

goroutine 90 [running]:
github.com/coredns/coredns/plugin/health.(*health).OnFinalShutdown(0xc000089bc0, 0xc000063d88, 0x4afe6d)
~~~

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-04 16:06:25 -04:00
Miek Gieben
890cdb5cab plugin/health: cleanups (#2811)
Small, trivial cleanup: got triggered because I saw a comment on how
health plugins polls other plugins which isn't true.

* Remove useless newHealth function
* healthParse -> parse
* Remove useless constants

Net deletion of code.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-04 16:06:04 -04:00
Billie Cleek
e178291ed6 kubernetes: never respond with NXDOMAIN for authority label (#2769)
* kubernetes: never respond with NXDOMAIN for authority label

Return a nodata response when trying to resolve the authority's label
for a record type that doesn't match the record type of the authority.

This guards against poisoning the authority record by requesting the
wrong record type for the authority label. For instance, given an
authoritative resolver that uses subdomain delegation for Kubernetes
services of a cluster that's configured to use IPv4, the parent may be
poisoned by querying it for the authority label of the cluster subdomain
with a AAAA record type, which would otherwise (i.e. without this
change) return an NXDOMAIN. That is, given
	cluster.example.com        NS 10800 ns.dns.cluster.example.com
	ns.dns.cluster.example.com A  10800 10.0.1.2
The parent may be poisoned for the SOA TTL by querying it for a AAAA
record of ns.dns.cluster.example.com, causing the parent to fail
delegate properly until the SOA TTL lapses.

* kubernetes: add tests for authority queries
2019-05-01 10:42:38 -04:00
Cricket Liu
b4485b48d9 Update README.md (#2808)
Minor grammatical fixes.
2019-04-30 13:49:53 -04:00
Chris O'Haver
ab1c0bb425
plugin/loop: Update troubleshooting step (#2804)
* Update README.md
2019-04-30 08:42:14 -04:00
Yong Tang
82862b44a3 Remove trailing whitespaces (#2806)
While running make notices the following:
```
** presubmit/trailing-whitespace
plugin/grpc/README.md:Multiple upstreams are randomized (see `policy`) on first use. When a proxy returns an error
plugin/pprof/setup_test.go:		{`pprof :1234 {
plugin/pprof/setup_test.go:		{`pprof {
** presubmit/trailing-whitespace: please remove any trailing white space
```

This fix removes the whitespaces

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-04-29 13:51:45 -04:00
Miek Gieben
39bc2af509
Add any plugin (#2801)
* Add any plugin

This adds the any plugin, a plain copy of coredns/any documented here
https://coredns.io/explugins/any/ as an external plugin.

Fixes: #2785

Signed-off-by: Miek Gieben <miek@miek.nl>

* Stickler bot nit

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-28 11:46:45 +01:00
Cricket Liu
72a633ba09 Update README.md (#2799)
s/from/form
2019-04-24 07:01:44 +01:00
Miek Gieben
3adfeaa857 plugin/chaos: randomize author list (#2794)
Randomize the author list on request; keep the zowners.go file stable so
a 'go generate' remain stable.

chaos.Owners could potentially be a map and be randomized by ranging
over it, but this seems simpler and fewer lines of code.

Bit of Easter hacking; seems more fair to randomize this list.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-23 23:21:28 +08:00
Miek Gieben
98c7a6effb plugin/health: clarify use a bit (#2791)
Make clearer how health works and that is it process wide.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-18 09:21:02 -07:00
Miek Gieben
be1ac9fed4
plugins: remove upstream [ADDRESS] from docs (#2772)
Various plugins still had this documented, the setup functions still
allow it (which is fine), but update the docs that this arguments isn't
there any more.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-08 16:45:29 +01:00
Kun Chang
be8b29cd4d [plugin/cache] cache failures (#2720)
* cache failures

* use ServerError
2019-04-08 11:15:05 +01:00
Miek Gieben
58c703f5ef
Run gofmt -w -s on codebase (#2773)
This formats and simplifies all code by running gofmt -w -s on all Go
files.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-08 11:13:46 +01:00
Miek Gieben
5a4e4d92ef
Doc tweaks (#2763)
* fix date on 150 release notes
* fix syntax in route53 plugin

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-06 08:43:19 +01:00
Miek Gieben
663271a7ca plugin/forward: remove proxy comparison (#2760)
*proxy* is removed, so this is moot

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-04 13:36:17 -07:00
John Belamaric
2418a6b2d2
plugin/kubernetes: Disable resync by default (#2752)
* Disable resync by default

* Document default resync
2019-04-02 14:55:25 -07:00
Fernando Ripoll
6f5b294d7e Add all policies to forward plugin docs (#2751) 2019-04-02 18:24:54 +01:00
John Belamaric
aea98acf2f
Bump the resync period to five hours (#2748) 2019-04-01 16:24:55 -07:00
Chris O'Haver
67fdd7f23f
Update README.md (#2747) 2019-04-01 10:38:17 -04:00