Commit graph

356 commits

Author SHA1 Message Date
John Belamaric
9ea8cde36e Grpc tracing (#544)
* checkpoint

* Pass context through ServeDNS, enable gRPC tracing

* Fix types and make tracer available to proxy. go fmt

* Fix imports

* Use the DoNotStartTrace option

* Change to SpanFilter from DoNotStartTrace

* Use new name (IncludeSpan)

* Final names

* Add tests; fix possible client/conn leaks in grpc

* go fmt
2017-03-01 10:41:54 -05:00
John Belamaric
838427c95d Remove deployment helpers that are now in coredns/deployment/kubernetes (#554) 2017-02-22 21:44:20 +00:00
Miek Gieben
4723fb9418 Gofmt all code (#552)
* Gofmt all code

* fmt
2017-02-22 16:06:20 +00:00
Miek Gieben
bf82f007fa Fix test (#549) 2017-02-22 09:23:41 +00:00
Miek Gieben
c5224b1048 Golint (#548)
* linter fixes

* Golint and format code

* fmt
2017-02-22 07:25:58 +00:00
Yong Tang
81af74aad0 Fix import path github.com/miekg/coredns -> github.com/coredns/coredns (#547)
This fix fixes import path from
`github.com/miekg/coredns`
->
`github.com/coredns/coredns`
2017-02-22 06:51:47 +00:00
Miek Gieben
7c59d39834 middleware/metrics: survive restart (#542)
* middleware/metrics: survive restart

Keep the handler running during restart. Stopping and starting the
handler results in "address in use" - sometimes, meaning the reload
will be flaky. In turn this behavior means any changes to the monitor
stanza are not picked up.

* remove resync
2017-02-21 19:34:40 +00:00
Miek Gieben
26242cef1b Document fallthrough and fix rewrite (#537)
* Document fallthrough and fix *reverse*

While documenting the fallthrough behavior and testing it I noticed
the did not properly work. This PR does a tiny bit too much as it

- Documents fallthrough
- Fixes fallthrough in reverse
- Makes directives_generate complain on duplicate priorities
- Moved reverse *before* file in middleware.cfg
- Add a test that tests the reverse fallthrough behavior with a file
  backend

Fixes #515

* ....and fix the tests
2017-02-20 21:00:00 +00:00
Miek Gieben
3e26398e08 middleware/file: additional section processing (#531)
Add additional section processing for MX and SRV records. Update the
tests.
2017-02-19 20:42:34 +00:00
John Belamaric
5aa30308d9 Various trace improvements (#527) 2017-02-16 17:13:18 +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
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
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
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
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
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
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
c4ab98c6e3 Add middleware.NextOrFailure (#462)
This checks if the next middleware to be called is nil, and if so returns
ServerFailure and an error. This makes the next calling more robust and
saves some lines of code.

Also prefix the error with the name of the middleware to aid in
debugging.
2016-12-20 18:58:05 +00:00
Dmytro Kislov
8cb5a05798 Return no items if less than 3 items in service segments 2016-12-14 16:17:14 +00:00
Miek Gieben
5d2e4db99d middleware/file: include sigs in additional (#456)
When asked for the NSset include glue and possible sigs in the
additional section.

Fixes #411
2016-12-14 12:50:00 +00:00