Commit graph

82 commits

Author SHA1 Message Date
John Belamaric
99287d091c
Watch feature (#1527)
* Add part 1 watch functionality. (squashed)

* add funcs for service/endpoint fqdns

* add endpoints watch

* document exposed funcs

* only send subset deltas

* locking for watch map

* tests and docs

* add pod watch

* remove debugs prints

* feedback part 1

* add error reporting to proto

* inform clients of server stop+errors

* add grpc options param

* use proper context

* Review feedback:
 * Removed client (will move to another repo)
 * Use new log functions
 * Change watchChan to be for string not []string
 * Rework how k8s plugin stores watch tracking info to simplify
 * Normalize the qname on watch request

* Add blank line back

* Revert another spurious change

* Fix tests

* Add stop channel.
Fix tests.
Better docs for plugin interface.

* fmt.Printf -> log.Warningf

* Move from dnsserver to plugin/pkg/watch

* gofmt

* remove dead client watches

* sate linter

* linter omg
2018-06-27 07:45:32 -07:00
Miek Gieben
6e466d5092 Remove dnsutil.Dedup (#1867)
Remove the code and remove the call in etcd and kubernetes handlers.
This does mean we should not add dups in the first place, which means
adding maps in backend_lookup to prevent dups from begin added.

This should cut down on the allocations because dnsutil.Dedup is very
expensive by converting everything to strings, we avoid doing that now.
2018-06-11 19:23:25 -07:00
darkweaver87
003e104fca ADD ignoreemptyservice option for kubernetes plugin (#1813)
* ADD: ignoreemptyservice option for kubernetes plugin

* Modify documentation and rename option to add space

* UPD: Add unit tests

* UPD: gofmt

* Add unit test for ignore emptyservice

* gofmt

* xfr tests failed

* Rename emptyservice to empty_service
2018-05-23 08:57:59 -04: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
0daa03a81f exclude terminating pods (#1602) 2018-03-13 07:06:03 +00:00
Miek Gieben
928de738dd
Rename reverse zone constants (#1568)
Rename the constants to IP4arpa and IP6arpa (shorter and exported) and
make IsReverse return the type of the reverse zone which could be handy
for some callers.

Also add tests for IsReverse()
2018-02-28 08:43:19 -08:00
Chris O'Haver
395b614349 plugin/kubernetes: PTR/A reverse query corner cases (#1551)
* better handle non PTR rev zone qrys

* vice versa

* tests

* comment typo

* much cleaner
2018-02-28 07:53:12 -08:00
Chris O'Haver
71ee323651 plugin/kubernetes: Add upstream @self and loop count (#1484)
* add upstream @self and loop count

* 1st round of feedback

* allow argless upstream

* update test

* readmes

* feedback
2018-02-14 21:11:26 +01:00
Chris O'Haver
ca5097ca13 reqd changes (#1522) 2018-02-12 14:27:16 -05:00
Brad Beam
6fd954f19c support for zone transfer for kubernetes (#1259)
* plugin/kubernetes: axfr

Hook up dynamic SOA serial by setting ResourceEventHandlerFuncs in
dnsController.

Add prototype of returns msg.Services via the Transfer function. Leave
expanding this to RRs out of scope for a bit.

* plugin/kubernetes: axfr

Respond to AXFR queries

* Fixing race condition

* Fixing instantiation of dnstest writer

* Updates from review
2018-02-08 16:11:04 +00:00
Chris O'Haver
449bb1ac6c
spelling (#1461) 2018-01-29 13:16:13 -05:00
Ilya Galimyanov
1e75061aec Remove pointers to labels.Selector and pass normally instead (#1422) 2018-01-24 20:44:18 +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
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
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
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
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
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
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
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
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
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
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
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
Renamed from middleware/kubernetes/kubernetes.go (Browse further)