Commit graph

21 commits

Author SHA1 Message Date
Miek Gieben
d8714e64e4 Remove the word middleware ()
* 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
Miek Gieben
9452a0a3bc mw/kubernetes: test cleanup ()
Move tests infra to look like all other middleware, and some small
cleanups.
2017-09-02 18:49:50 +02:00
Mohammed Naser
8f77566cdd Add test for SRV on root () 2017-09-01 08:55:09 +02:00
Miek Gieben
4049ed4f4b mw/kubernetes: add configurable TTL ()
* mw/kubernetes: add configurable TTL

Add ttl option to kubernetes. This defaults to 5s but allows
configuration to go up to 3600.

Configure the tests so that a few actually check for the 5s, while the
rest use the TTL of 303 which is ignored by the checking code.

Fixes 

* fix tests

* and more
2017-08-26 17:32:46 -07:00
Miek Gieben
e06863d2be mw/kubernetes: split up tests cases ()
Split up the handler_test in four files that all tests their specific
bits. Removed the CNAME sort as there was only 1 answer with a CNAME
and that was a single one.

See , this fixes (a bit) the tests in middleware.
2017-08-24 19:42:45 +01:00
Sandeep Rajan
5e9991556e Middleware/Kubernetes: Add RR check to K8s integration tests () 2017-08-24 11:05:16 -04:00
Miek Gieben
61fc672e19 mw/kubernetes: remove kPod and kServices ()
Based up on: , but redone in a new PR with some cherry-picked
commits:
aacb91ef0b
5dc34247b7

This removes kPod and Kservice and creates []msg.Service from k.findPods
and k.findServices.

Updated few tests which I *think* are correct; they look correct to me.
2017-08-23 07:19:41 +01:00
Miek Gieben
7f5086e97a mw/kubernetes: don't export Pod-mode constants. ()
* mw/kubernetes: don't export Pod-mode constants.

* merged
2017-08-22 22:11:48 +01:00
Miek Gieben
6a4e69eb9f mw/kubernetes: Rewrite parseRequest and Readability improvements ()
* mw/kubernetes: rewrite parseRequest

Stop looking at the qtype in parseRequest and make k.Namespace a map.
Fallout from this is that pkg/strings as it is not used anymore. Also
add a few helper functions to make unexposed namespaces easier to see in
the code.

Add wildcard tests to the middleware tests.

* Fix tests

Add a whole bunch of comments to document what we are trying to do.

* This is now answered

* up coverage

* duh

* Update testcase

* Make it nodata
2017-08-22 12:44:42 -07:00
Miek Gieben
f96cf27193 mw/federation: add federation back as separate mw for k8s ()
* mw/federaration

This PR add the federation back as a middleware to keep it more
contained from the main kubernetes code.

It also makes parseRequest less import and pushes this functionlity down
in the k.Entries. This minimizes (or tries to) the importance for the
qtype in the query. In the end the qtype checking should only happen
in ServeDNS - but for k8s this might proof difficult.

Numerous other cleanup in code and kubernetes tests.

* up test coverage
2017-08-18 14:45:20 +01:00
Miek Gieben
7f46df6d27 tests: add SortAndCheck helper ()
There was quite some code duplication in a lot of tests to check if
an answer was considered Ok. Created a test.SortAndCheck helper function
that takes care of this.
2017-08-16 15:30:58 +01:00
Miek Gieben
06644c2855 mw/kubernetes: add reverse_test.go ()
This PR adds a reverse tests that copies some of it from the main
integration test. This aids in local testing because you don't need
a full k8s setup running.

It does the most minimal testing, a successful return and a nodata
response that includes the SOA for in-addr.arpa.
2017-08-16 07:33:35 +01:00
Miek Gieben
00f5c7797e mw/kubernetes: remove federation and cidr ()
* mw/kubernetes: remove federation and cidr

Remove both as we have a corefile syntax change that handles cidr and
remove federation because that is going to be its own middleware.

* backwards incompat changes

This PR:
* removes cidr from kubernetes (core Corefile feature now)
* removes federation from kubernets (comes back as new middleware)
* [remove autopath - which was already gone, so that already was
  backwards incompat]
* adds `fallthrough` to the *etcd* middleware and makes you enable it.
* Fail on unknown properties
* documentation
* Disable TestHealthCheck as it uses realtime and fails
2017-08-14 08:49:26 +01:00
Miek Gieben
0bc1ff7408 mw/kubernetes: autopath refactors ()
Factor out as much of autopath into a subpackage as possible right now.
apw.Sent is not needed, we should see this from the rcode returned by
the middleware. See  on why this was needed.

Disable the tests for now as to not break the main build.
2017-08-07 14:45:30 -07:00
Miek Gieben
760e667063 middleware/kubernetes: autopath in sub package ()
Put the autopath stuff in a separate sub package. Tests are still
included in the main kubernetes directory.

Next steps (after this is merged), is pulling the autopath handling
into the subpackage and fixing the tests.
2017-08-07 07:09:32 -07:00
Miek Gieben
bcb2eb1ecc all: gometalinter ()
* kubernetes/reverse: remove deadcode
* deadcode in errors and kubernetes removed
* unnecessary conversion
* constants
* proxy: time.Since()
* simplications
* static check
* Disable test/external_test
2017-08-06 05:54:24 -07:00
Miek Gieben
2c0fc3182c middleware/kubernetes: cleanup ()
Drop the interfaceAddr interfaces and just use a function. Cleanup
all fallout from that. Remove the use of global variables and cleanup
the tests a bit.
2017-08-03 23:14:11 -07:00
Sandeep Rajan
8ad8c75ab4 Middleware/k8s: Add unit tests for Pods ()
* Added Pod testing

* Cleanup

* fixed formatting
2017-08-03 12:16:50 -07:00
Sandeep Rajan
2410f5b3f4 Add TXT coverage () 2017-08-02 12:42:15 -04:00
Chris O'Haver
58006cf847 middleware/kubernetes: fix aaaa response ()
* fix aaaa response

* unit tests
2017-07-20 08:19:29 -04:00
Chris O'Haver
8495e48297 k8s/autopath: Add CNAMES ()
* Add unit tests & cnames

* more progress

* fix

* next mw dependent unit tests

* add tests for OnNXDOMAIN

* Add AAAA and ndots unit tests; fix request.NewWithQuestion

* Correct default value in README

* add CNAMEs to readme

* review

* fix autopath examples

* fix and test CNAME response order
2017-07-11 18:05:32 -04:00