Commit graph

530 commits

Author SHA1 Message Date
Miek Gieben
bcd9c8b0fb server: fix data race (#536)
* server: fix data race

This fixes the detected race.

Fixes #534

* Remove the listener and packetconn from Server

There does not seem a need to store the listener and packetconn again
in the Server structure. The dns.Servers already has access to them
and can also shutdown the handlers.
2017-02-19 20:34:09 +00:00
John Belamaric
5aa30308d9 Various trace improvements (#527) 2017-02-16 17:13:18 +00:00
John Belamaric
bd033ef6c7 Make go generate run whenever middleware.cfg is changed (#530) 2017-02-16 17:12:19 +00:00
John Belamaric
84fb9b8469 Fix make gen (#526)
When using an external middleware, the generated file was failing to compile.
The issue is a typo in directives_generate.go that left imports with an
unterminated string.
2017-02-15 16:38:55 +00:00
Miek Gieben
34db56a22e readme updates (#525) 2017-02-15 08:03:14 +00:00
John Belamaric
061b3fc1bd Client-side of gRPC proxy (#511)
* WIP: Client-side of gRPC proxy

* Add tests

* gofmt

* Implement OnShutdown; add a little logging

* Update for context in Exchange change

* go fmt

* Update README

* Review comments

* Compiling is good

* More README improvements
2017-02-14 22:20:20 -05:00
Miek Gieben
98c86f3f9f go gen improvements (#524)
Remove the "gen" directory and move directives_generate.go out of it.
Add a build ignore tag so it isn't build by default. Cleanup the go gen
invocations so there are not seen as package docs.

Simplify the code a bit and don't run go gen twice.
2017-02-14 19:23:18 +00:00
Miek Gieben
a5f3cb5fe5 La context (#521)
* middleware/proxy: give Exchange a context

Make context.Context the first paramater in the Exchange method.
This is inline with all other query functions.

* up the version
2017-02-11 16:56:04 +00:00
Miek Gieben
5f6c7682be core: make coredns.Server a caddy.GracefulServer (#520)
* core: make coredns.Server a caddy.GracefulServer

We needed to also implement the Address() method.

Fixes: #519

* Add compile time check if we implement caddy.GracefulServer

* Check if we should shutdown
2017-02-10 19:50:31 +00:00
Miek Gieben
3e196a6d57 middleware/reverse: random updates (#516)
* middleware/reverse: random updates

Make the documentation somewhat shorter (and hopefully clearer in the
process). Also to be on-par with the *auto* middleware, start counting
the referenced zones from 1 (instead of 0).
Some variable cleanups and use the NextOrFailure in the ServeDNS
function.

* More TODOs
2017-02-10 12:48:51 +00:00
John Belamaric
87a39a6353 Update to point to coredns/coredns image (#517) 2017-02-09 21:58:32 +00:00
Richard Hillmann
61afc6dbad Add middleware reverse (#452) 2017-02-09 19:39:48 +00:00
Miek Gieben
a7c9fd5d6b Release 005 2017-02-09 18:47:21 +00:00
Bob Wasniak
22e39a072a Allow override of container name (#512) 2017-02-09 18:27:31 +00:00
Chris O'Haver
353c1c6487 Fix k8s chaining (#510)
* fix k8s next middleware chaining

* add chain to integration tests

* if nit
2017-02-08 12:53:55 -05:00
Bob Wasniak
fa1c90a479 Add field keywords to rewrite middleware (#497)
* Require Field for rewrite rules

* review feedback changes

* fix ut

* fix typo, add warning message
2017-02-07 21:53:16 +00:00
Miek Gieben
b8e75509cc Merge branch 'master' of github.com:miekg/coredns 2017-02-07 21:30:13 +00:00
Miek Gieben
fa0abe7473 middleware/proxy: sane(r) metrics
Add proxy_proto and re-instate proto to be the protocol of the incoming
query ("tcp" or "udp").
2017-02-07 21:28:47 +00:00
Chris O'Haver
4b6860fc81 Fix k8s PTR when all namespaces exposed (#507)
* check for no namespace filter

* integration test
2017-02-07 16:22:43 -05:00
Miek Gieben
89dc5720d0 And make it actually work (#508) 2017-02-07 21:03:17 +00:00
Chris O'Haver
fd4c5b5744 Fix no PTR records response for cidr ranges (#506)
* set zone for cidr based PTRs

* set zone to request
2017-02-07 13:58:52 -05:00
Miek Gieben
dbe1b2510d middleware/proxy: fix except keyword (#505)
Fix the except keyword usage - the config would allow it, but it was
not enforced in the code.
Turns out that **FROM** was also not enforced, fix both, by (basically)
copying the code from Caddy.

Update the README and tests.

Locally test as well, shows that this works:

~~~
.:1053 {
    proxy miek.nl 8.8.8.8:53 {
        except a.miek.nl
    }
    proxy a.miek.nl 8.8.4.4:53

    errors stdout
    log stdout
}
~~~

And gives the desired results, not having a proxy line for `a.miek.nl`
results in a SERVFAIL (as expected).

Fixes #502
2017-02-07 18:01:16 +00:00
John Belamaric
e8ebcd3cfd * Add script to generate manifest (#504) 2017-02-07 07:36:01 +00:00
Miek Gieben
123a76c91e middleware/proxy: absorb httpproxy (#481)
* middleware/proxy: absorb httpproxy

Move the httproxy into proxy. This adds and Exchanger interface which
is used to exchange the messages with the upstream.

The https_google upstream will re-resolve itself and update the upstream
hosts used every 300s.

* Remove and add TODO
2017-02-06 19:32:48 +00:00
Chris O'Haver
77f957d443 k8s middleware add tests and docs update (#501)
* add cidrs opt

* remove state data from middleware object

* update k8s docs

* Add integration tests

* add unit tests for cidr and pods config

* more README fixes, separate dev notes

* adjust section headers

* fix typo
2017-02-02 16:51:42 -05:00
Chris O'Haver
8beb1b2166 Allow cidr based reverse zone config (#500)
* add cidrs opt

* remove state data from middleware object
2017-02-01 12:56:10 -05:00
John Belamaric
3a04d2a306 Changes needed to support external gRPC server middleware (#498)
The gRPC server middleware[1] needs access to the Server object
in order to push the unpacked Msg through the normal middleware
pipeline. These are the changes to core needed to make that
possible.

[1] https://github.com/infobloxopen/coredns-grpc
2017-01-31 22:21:55 +00:00
Bob Wasniak
439d8b8d12 middleware.cfg to configure middleware directives (#496)
* Use go generate to build middleware setup based on middleware.cfg
Init default config

* generated files

* Move gen to an isolated area

* rename files

* PR review updates

* undo readme
2017-01-31 17:25:02 +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
John Belamaric
bc301be5ee Add tracing option (#487)
Adds a middleware to enable tracing with OpenTracing/OpenZipkin.
Enabling tracing will have a large impact on performance so it is
not advisable in production.
2017-01-23 15:40:47 -05:00
Chris O'Haver
c62bd639ff correct k8s name parsing response codes (#493) 2017-01-23 20:11:32 +00:00
devnev
299360fe01 Fix panic caused by missing metric labels in proxy. (#492) 2017-01-23 15:30:21 +00:00
Dmytro Kislov
c68dc7c1aa truncated cache fix (#485) 2017-01-22 20:32:08 +00:00
Chris O'Haver
a1215974ee only a * by itself is wild (#488) 2017-01-22 08:15:12 +00:00
Miek Gieben
166c822d91 docs: update the zone specification (#490)
Add more words about how to specify the zone:port in a Corefile.

Fixes #489
2017-01-22 08:14:48 +00:00
Chris O'Haver
adfd7d5b19 Add pod cache and verified pod responses (#483)
* Add pod cache and verified pod responses

* add ip indexing for pod cache
2017-01-20 07:22:11 +00:00
Miek Gieben
51a34d934d middleware/proxy: drop protcol in metric
This blows up prometheus (panic in CoreDNS) and is not that
handy to have.
2017-01-18 20:33:18 +00:00
John Belamaric
7c45f0227a Merge pull request #482 from chrisohaver/k8s_spec_txt
Add txt response per k8s spec
2017-01-15 18:06:50 -05:00
Chris OHaver
2d0b8293a4 Add txt response per k8s spec 2017-01-15 14:37:18 +00:00
Miek Gieben
52e01264e8 middleware/proxy: implement Exchanger (#480)
By defining and using an proxy.Exchanger interface we make the proxy
more generic and we can then fold back httproxy into proxy.

This overrides #463 and #473 and should make futures extensions rather
trivial

* Add docs that talk about `protocol` and how to set it.
* middleware/proxy: rename New to NewLookup
  It's used as a Lookup mechanism not as a completely new proxy,
  reflect that in the name.
* Set maxfails to 3 by default when looking up names.

Most of the changes have been copied
from https://github.com/johnbelamaric/coredns/pull/1/files
2017-01-15 08:12:58 +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
Chris O'Haver
b6a2a5aeaa Pod insecure2 (#479)
* return servfail for pod rqsts when pods disabled

* Add integration test for disabled pod mode
2017-01-12 11:57:00 -05:00
John Belamaric
2e366459c5 Use common TLS parsing routine for etcd (#476)
* Use common TLS parsing routine for etcd

Change to use the new common routine, and update the docs to reflect
the different options for passing TLS configuration.

* Move middleware/tls to middleware/pkg/tls

This was put in the wrong place originally.
2017-01-12 08:14:24 +00:00
Miek Gieben
94c59da577 Run tests in parallel (#478)
Create a small speedup running the tests:

PASS
ok  	github.com/miekg/coredns/test	10.329s

PASS
ok  	github.com/miekg/coredns/test	6.079s

Skip the etcd ones. Doing the middleware/*/*_test ones doesn't yield
any speedup as these are still done on a per directory basis.
2017-01-12 08:13:50 +00:00
Miek Gieben
0c3ad499d8 middleware/proxy: add read/writeDeadline (#477)
Add deadline to break the connection. We use the default of 5 seconds.
After this the backend is marked unhealthy and not used for some time.

Fixes #467
2017-01-11 21:23:57 +00:00
Chris O'Haver
0ee88d3007 Add insecure A records for pods (#475) 2017-01-11 21:23:10 +00:00
John Belamaric
b10a4f9075 Common tls (#474)
* Add common TLS config routines

These routines can be used to load TLS configs based upon the
args in the Corefile.

* Add common routine for Corefile arg handling

Add the NewTLSConfigFromArgs routine so that you can just pass
in the Corefile args and get a tls.Config. This ensures the
parameters are handled consistently across middleware.

* Change to varargs style params

Change to use args ...string instead of []string. Add
documentation of what each call means.
2017-01-10 10:18:34 -05:00
Miek Gieben
53ac25d1c3 Add middleware/erratic (#471)
This middleware allows playing with responses. Only one type is
implemented: it allows you to drop queries. I.e. withhold the response
from the client.
2017-01-06 09:42:30 +00:00
Chris O'Haver
9a5e0c64fd handle A/PTR/SRV for headless services/endpoints (#464)
* handle A/PTR/SRV for headless services/endpoints

* error early if _proto will produce nothing

* remove wc params + various style tweaks

* Release 004

* handle A/PTR/SRV for headless services/endpoints

* error early if _proto will produce nothing

* remove wc params + various style tweaks

* optimize srv prefix validation

* poking travis

* reduce response sizes, clean func params
2017-01-05 15:09:59 +00:00
Miek Gieben
39af7e4076 Release 004 2017-01-01 10:38:47 +00:00