Commit graph

40 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Chris O'Haver
9b8ee1c119
plugin/k8s: fix endpoint index creation (#1222) 2017-11-10 15:38:45 -05:00
Chris O'Haver
a78f46fb28 plugin/k8s: Use service IP index in reverse lookups (#1212)
* use index for svc reverse lookup

* temp revert

* restore reverse.go

* restore reverse_test.go
2017-11-10 16:59:21 +00:00
Chris O'Haver
1a96fd2aee plugin/k8s: fix pods disabled behavior (#1207)
* fix pods disabled behavior

* do away with pod mode specific error
2017-11-08 18:58:48 +00:00
Chris O'Haver
0b93ea5147 k8s readme tweaks (#1206)
fix minor capitalization and grammar errors
2017-11-08 12:08:32 -05:00
Brian Akins
3527be6c00 Add option to use pod name rather than IP address for Kubernetes (#1190)
Change to use a new 'endpoints' directive and use a constant

Add initial docs for 'endpoints' directive

Add tests to Kubernetes setup for endpoints

Changes based on PR feedback

endpoint_pod_names is a boolean config option. Chahanged docs to reflect this.

Add a test when endpoints_pod_names is not set

Update README.md

Remove endpointNameModeName as it is no longer used
2017-11-08 08:07:10 -05:00
Miek Gieben
2c80551fdc
plugin/{kubernetes/etcd}: dynamic SOA (#1188)
Add a dynamic SOA record (at least the serial and minttl). This create
another interface that should be implemented by the backends.

For now default to returning epoch in as a uint32 (no change from
before).

Lower the minTTL returned to 30s (from 60s)
2017-11-01 10:11:34 +00:00
Miek Gieben
fa2ae3fb43 docs: updates some, remove others (#1187)
Fix typo in kubernetes/README.md and remove DEV-README.md as it is stale
and information on the website is more up to date.

Remove large sections of text in plugin.md; just talk about how to
structure your plugin and docs.
2017-10-31 09:33:41 -04:00
Miek Gieben
cc490a8912 plugin/kubernetes: lazy initialze EndPointsList (#1168)
If we don't need it, don't initialize it.

Fixes #1156
2017-10-24 12:44:34 +01:00
Miek Gieben
fcd0342e42 CIDR query routing (#1159)
* core: allow all CIDR ranges in zone specifications

Allow (e.g.) a v4 reverse on a /17. If a zone is specified in such a
way a FilterFunc is set in the config. This filter is checked against
incoming queries.

For all other queries this adds a 'x != nil' check which will not impact
performace too much. Benchmark function is added as well to check for
this as wel.

Add multiple tests in tests/server_reverse_test.go.

Benchmark shows in the non-reverse case this hardly impact the speed:

~~~
classless:
pkg: github.com/coredns/coredns/core/dnsserver
BenchmarkCoreServeDNS-4   	 1000000	      1431 ns/op	      16 B/op	       1 allocs/op

pkg: github.com/coredns/coredns/core/dnsserver
BenchmarkCoreServeDNS-4   	 1000000	      1429 ns/op	      16 B/op	       1 allocs/op

master:
pkg: github.com/coredns/coredns/core/dnsserver
BenchmarkCoreServeDNS-4   	 1000000	      1412 ns/op	      16 B/op	       1 allocs/op

pkg: github.com/coredns/coredns/core/dnsserver
BenchmarkCoreServeDNS-4   	 1000000	      1429 ns/op	      16 B/op	       1 allocs/op
~~~

* README.md updates
2017-10-24 10:16:03 +01:00
Miek Gieben
d64b684831 plugin/kubernetes: implement HasSynced() (#1155)
* plugin/kubernetes: wait until api is ready

Wait for HasSynced before allowing startup to avoid startup race.

Also do a small refactor in findServices() to pull a check out of the
loop - only needs to be done once.

* sigh
2017-10-20 22:53:17 +01:00
Sandeep Rajan
b6b05eae8f Plugin/Kubernetes: Service and Endpoint Indexing (#1149)
* indexing

* corrections
2017-10-17 21:30:54 -04:00
Miek Gieben
e34e2c251f plugin/proxy: kick of HC on every 3rd failure (#1110)
* healthchecks: check on every 3rd failure

Check on every third failure and some cleanups to make this possible. A
failed healthcheck will never increase Fails, a successfull healthceck
will reset Fails to 0. This is a chance this counter now drops below 0,
making the upstream super? healthy.

This removes the okUntil smartness and condences everything back to 1
metrics: Fails; so it's simpler in that regard.

Timout errors are *not* attributed to the local upstream, and don't get
counted into the Fails anymore. Meaning the 'dig any isc.org' won't kill
your upstream.

Added extra test the see if the Fails counter gets reset after 3 failed
connection.

There is still a disconnect beween HTTP healthceck working the proxy (or
lookup) not being able to connect to the upstream.

* Fix tests
2017-10-15 19:38:39 +02:00
Miek Gieben
427aed6f5b doc update (#1140)
* doc update

Go through all README and fix mistakes, extend example and let more
corefile snippets be test for validity.

* Cant use spefic addr in test
2017-10-10 09:39:35 +02:00
Chris O'Haver
4b3a430ff2 plugin/kubernetes: Enable protobuf, Update client api package (#1114)
* vendor

* code
2017-09-29 15:58:50 -04:00
Miek Gieben
148a99442d healhcheck: various cleanups (#1106)
* healhcheck: various cleanups

Network wasn't used. IgnorePaths wasn't used. Move checkdown function to
common function shared between proxy protocols. And some naming fixed.

Also reset the Fails on a succesful healthcheck back to 0.

remove newlines from log

* compile

* fix test
2017-09-24 19:37:43 +01:00
John Belamaric
6f19dda0b4 Fix autopath crash when pods verified not enabled (#1099) 2017-09-21 18:06:35 +01:00
Miek Gieben
284061eee7 pkg: add dnstest (#1098)
Add a full test server impl in this new package + tests. Move
dnsrecorder into this package as well and finish up the commented out
tests that were left in the old dnsrecorder package.

Update all callers and tests.
2017-09-21 15:15:47 +01:00
Miek Gieben
2388e36c2c plugin: README.md updates (#1084)
updates so the look better on coredns.io
2017-09-15 22:27:55 +01:00
Miek Gieben
d8714e64e4 Remove the word middleware (#1067)
* Rename middleware to plugin

first pass; mostly used 'sed', few spots where I manually changed
text.

This still builds a coredns binary.

* fmt error

* Rename AddMiddleware to AddPlugin

* Readd AddMiddleware to remain backwards compat
2017-09-14 09:36:06 +01:00