Commit graph

29 commits

Author SHA1 Message Date
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
Miek Gieben
3e252deabb Remove debug queries (#1058)
* Remove debug from interface and methods

* remove debug queries from etcd

* remove debug queries from k8s - they were not used

* And remove from mw/proxy-google as well

* Remove debug query test
2017-09-12 10:52:43 +01:00
Miek Gieben
6a4e69eb9f mw/kubernetes: Rewrite parseRequest and Readability improvements (#939)
* 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 (#929)
* 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
00f5c7797e mw/kubernetes: remove federation and cidr (#916)
* 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
241e3dbcb7 mw/k8s: cleanups (#893)
* mw/k8s: cleanups

Remove some constants that aren't used any more. Make PrimaryZone
private because it doesn't need to be exported. Remove test that
did not cover corner case as expressed in setup.go

* cleanup this as well
2017-08-11 16:21:07 +01:00
Miek Gieben
7e56cc74e5 WIP: Parserequest2 cutback (#868)
* middleware/kubernetes: pull TXT out of parseRequest

Put the TXT handling one layer higher and remove it from parseRequest.
Also rename the podsvc field in there to podOrSvc. Now that it isn't
used anymore for TXT record (dns-version) that was put in there. We can
make this a boolean (in a future PR).

Make parseRequest get an optional Zone that is from state.Zone and use
that instead of its own code. Removed some tests and other smaller
cleanups.

Fixes #836

* add this reverse

* another check

* readd

* Rename to kPod and kService for some clarity
2017-08-10 01:08:58 -07:00
Miek Gieben
df1879f9ae middleware/kubernetes: put reverse function in own file (#863)
Move reverse function and (some) test code to reverse*.go
2017-08-09 05:18:46 -07:00
Miek Gieben
0bc1ff7408 mw/kubernetes: autopath refactors (#850)
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 #852 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
bcb2eb1ecc all: gometalinter (#843)
* 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
c84df38ac5 middleware/kubernetes: fixes (#837)
dedent code, use shorter names.
use strings.EqualFold instead ToLower to avoid create garbage.
2017-08-05 12:29:43 -07:00
Yong Tang
c08497adee Misspell correction (#826)
Did a `misspell . | grep -v ^vendor` and fixed
several typos.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-04 09:06:06 -07:00
Miek Gieben
21386ebdd5 middleware/kubernetes: define consts (#824)
Define two consts Pod and Svc, makes it stand out a little more
when used in switches in case.

We have opted for a new type, but then you need to convert them
all the time with string(Foo).
2017-08-04 10:34:00 -04:00
Markus Sommer
d0d7f4c89a Kubernetes srv (#823)
* Treat absence of port/service in SRV as wildcard

Normally, a SRV-request should have the form
_<service>._<port>.<name>.<zone>. The k8s peer-finder which is used for
bootstrapping by some applications will however query for SRV at
<name>.<zone>.

To compensate for this behaviour, treat the absence of _<service> and
_<port> as wildcards.

* Modified tests with new SRV behaviour

Added a testcase for a SRV request without port & service
Removed now valid query from invalidSRVQueries

* Forgot to run gofmt on test/kubernetes_test.go
2017-08-04 09:41:55 -04:00
Miek Gieben
2c0fc3182c middleware/kubernetes: cleanup (#818)
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
Miek Gieben
cd1f2f1bbf mw/kubernete: small cleanup (#810)
* mw/kubernete: small cleanup

Small cleanup, avoid pointer to []msg.Services and just returns the
msg.Service.

* Actually compile

* testss
2017-08-03 09:03:53 -07:00
Chris O'Haver
edf71fb168 middleware/kubernetes: Server side path lookups (#750)
* initial commit

* add config options

* add readme

* rewording

* revert unlreated change

* normalize host domain path

* add ndots opt, allow > 1 host domains, pull host domains from resolv.conf

* implementing review feedback

* update readme

* use dns lib, config format, defaults

* Correct autopath example.
2017-06-28 18:44:30 -04:00
Chris O'Haver
7219bff11f compress empty implementations to single line (#740) 2017-06-16 09:11:53 -07:00
Miek Gieben
e49ca86ce4 cleanup: go vet and golint run (#736)
* cleanup: go vet and golint run

Various cleanups trickered by go vet and golint.

* Fix tests and lowercase all errors

Lowercase all errors, some tests in kubernetes use errors from
kubernetes which do start with a capital letter.
2017-06-14 09:37:10 -07:00
Chris O'Haver
5c10eba31c handle clusterIP endpoint queries (#730) 2017-06-14 10:29:41 -04:00
Chris O'Haver
930c54ef62 middleware/kubernetes: Implement current federation beta (#723)
* federation initial commit

* UTs/bugfixes

* federation bits

* polish, cover UT gaps

* add TODO

* go fmt & todo note

* remove unrelated change

* pr changes

* start node watcher

* get real node name

* remove unused case
2017-06-14 09:38:00 -04:00
Chris O'Haver
18bc52b5e0 add more coverage (#702) 2017-06-03 08:27:24 +01:00
Chris O'Haver
d917ff5ac2 Add k8s external service CNAMEs (#677)
* Add external service cnames

* remove cruft

* update CI k8s version

* change CI k8s version

* min k8s ver for ext services

* trying k8s 1.5

* k8s 1.5 requires ports spec

* remove kruft

* update dns schema version
2017-05-30 13:20:39 +01:00
Chris O'Haver
7f950e496a Handle K8s middleware NS record (#662)
* commit for testing in cluster

* commit for testing in cluster

* refactor and add ns.dns record

* Release 007

* reduce heap allocations

* gofmt

* revert accidental Makefile commits

* restore prior rcode for disabled pod mode

* revert Makefile deltas

* add unit tests

* more unit tests

* make isRequestInReverseRange easier to test

* more unit tests

* addressing review feedback

* commit setup.go
2017-05-22 16:05:48 -04:00
Miek Gieben
12678ac5e2 middleware/kubernetes: doc cleanup (#571)
Set of small cleanups.
2017-03-06 11:42:59 +00:00
Yong Tang
738067a3c7 Fix go fmt, go lint, and go vet issues (#494)
This fix fixes several `go fmt`, `go lint`, and `go vet` issues,
to make goreportcard happy:

https://goreportcard.com/report/github.com/miekg/coredns

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-29 20:06:26 +00:00
Chris O'Haver
a1215974ee only a * by itself is wild (#488) 2017-01-22 08:15:12 +00:00
Chris O'Haver
a6d232a622 dont require/allow "_" prefix for srv wildcard fields (#472)
* dont require/allow "_" prefix for srv wildcard fields

* streamline parse/validation of req name

* removing nametemplate

* error when zone not found, loopify unit tests
2017-01-15 08:12:28 +00:00
Manuel de Brito Fontes
2b62384223 Refactoring of k8s helpers 2016-09-23 09:48:11 -03:00