Commit graph

32 commits

Author SHA1 Message Date
Miek Gieben
c1c98924c3
Add new plugin: external - resolve k8s ingress and LB address with external names (#2379)
* Add new plugin: external

This plugin works in conjunction with the kubernetes plugin and exports
ingress and LB addresses as DNS records. It bypasses backend.go and
backend_lookup.go flow because it is not needed.

README, tests are implemented. The tests only exercise the unit tests,
this has not been tested in any ci.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Rename to k8s_external

Signed-off-by: Miek Gieben <miek@miek.nl>

* go gen

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-12-14 09:41:51 +00:00
Miek Gieben
84ec780ffc
New plugin: loop (#1989)
* New plugin: loop

Add a plugin that detects loops. It does this by sending an unique query
to our selves. If we see the query more than twice we stop the process.
If there isn't a loop, the plugin disables it self and becomes a noop
plugin.

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-20 19:45:17 +01:00
Miek Gieben
99800a687c
plugin/metadata: metadata is just label=value (#1914)
This revert 17d807f0 and re-adds the metadata plugin as a plugin that
just sets a label to a value function.

Add package documentation on how to use the metadata package. Make it
clear that any caching is up to the Func implemented.

There are now - no in tree users. We could add the request metadata by
default under names that copy request.Request, i.e

request/ip - remote IP
request/port - remote port

Variables.go has been deleted.

Signed-off-by: Miek Gieben <miek@miek.nl>
2018-07-01 20:01:17 +01:00
Eugen Kleiner
17d807f05f plugin/metadata: add metadata plugin (#1894)
* plugin/metadata: add metadata plugin

* plugin/metadata: Add MD struct, refactor code, fix doc

* plugin/metadata: simplify metadata key

* plugin/metadata: improve setup_test

* Support of metadata by rewrite plugin. Move calculated variables to metadata.

* Move variables from metadata to pkg, add UTs, READMEs change, metadata small fixes

* Add client port validation to variables_test

* plugin/metadata: improve README

* plugin/metadata: rename methods

* plugin/metadata: Update Metadataer interface, update doc, cosmetic code changes

* plugin/metadata: move colllisions check to OnStartup(). Fix default variables metadataer.

* plugin/metadata: Fix comment for method setValue

* plugin/metadata: change variables order to fix linter warning

* plugin/metadata: rename Metadataer to Provider
2018-06-29 10:44:16 +01:00
Miek Gieben
3e6489ef67 Remove the deprecate plugins (#1612)
Remove startup and shutdown completely
2018-03-14 21:18:29 +00:00
Miek Gieben
6cec66ce40
plugin/reload: enable (#1587)
Couldn't revert the original commit, just manually perform the needed
tweaks.
2018-03-02 17:17:26 -08:00
Miek Gieben
2e894eb0a2
plugin/reload: disable for now (#1511)
Reloading should work (kill -TERM reload the coredns process), but a lot
of plugins can't handle it proper. Disable to reload plugin until we fix
(most) of the plugins
2018-02-09 11:30:55 +00:00
John Belamaric
0b35d4d28f Reload hook (#1445)
* Add reload directive

* gofmt

* Fix default jitter and error message

* remove unneeded call to NextArg, add a couple negative setup tests

* Review feedback
2018-01-27 10:42:57 +00:00
Miek Gieben
c56fa8dbd3
Updates (#1432)
* Enable forward

* Regen all docs
2018-01-25 21:59:08 +00:00
Miek Gieben
77bd7eaede
Add on plugin (#1412)
Enable this Caddy plugin by default. Docs will go up coredns.io for this
as well.

See https://caddyserver.com/docs/on
2018-01-25 11:02:51 +00:00
Yong Tang
584dd87c70
Add route53 plugin (#1390)
* Update vendor

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add route53 plugin

This fix adds route53 plugin so that it is possible to
query route53 record through CoreDNS.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-01-15 09:59:29 -08:00
Tobias Schmidt
850288ecd7 Allow shuffling/loadbalancing cached responses (#1383) 2018-01-11 18:59:56 +00:00
Miek Gieben
dd37627e8e
plugin/template: README tweaks (#1361)
* plugin/template: README tweaks

* Go gen it
2018-01-08 13:13:25 +00:00
Yong Tang
c6937b0bfc Expose directives in dnsserver to help external plugin developers (#1315)
This fix expose directives in dnsserver package, so that external
plugin developers could easily build customerized coredns+plugin
without changing the code base tree of coredns.

The following is an example that could bundle coredns+example,
in one simple file without modifying coredns codebase:

```
package main

import (
        _ "github.com/coredns/example"

        "github.com/coredns/coredns/coremain"
        "github.com/coredns/coredns/core/dnsserver"
)

var directives = []string{
        "example",
        "log",
        "errors",
        ...
        ...
        ...
        "whoami",
        "startup",
        "shutdown",
}

func init() {
        dnsserver.Directives = directives
}

func main() {
        coremain.Run()
}
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-12-15 07:26:36 +00:00
Yong Tang
b52c3418b2
Add NSID plugin support for CoreDNS (#1273)
* Add NSID plugin support for CoreDNS

This fix adds NSID plugin support for CoreDNS, as was proposed
in 1256.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add test cases for NSID plugin

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Generate code for NSID plugin

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Use hostname as the default (as with bind), and remove unneeded copy

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add README.md

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-12-04 08:28:27 -08:00
Miek Gieben
0c63248a0e plugin/autopath: move after cache (#1147) 2017-10-17 20:09:25 -04: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
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
b46b9880bd WIP: autopath as middleware (#859)
autopath as middleware
2017-08-09 03:13:38 -07:00
Miek Gieben
050eccd69e mw/logs: add rflags to logging (#845)
Add the DNS message response flags as {rflags} to the default logging
Also complete the replacer testing that is was commented out.
And (unrelated) Switch erratic and whoami to ease testing.

Note: {flags} could and should be added as well - but we can leave that
as a beginners bug.
2017-08-07 03:49:40 -07:00
varyoo
1b7492be6e WIP: middleware/dnstap (#711)
middleware/dnstap add
2017-07-24 14:12:50 -07:00
Miek Gieben
8e86fa6f23 middleware/debug: add (#735)
* middleware/debug: add

Add a debug "middleware" that disables the recover() and just lets
CoreDNS crash; very useful for testing.

Fixes ##563

* fix test

* Feedback: check the value of Debug
2017-06-13 16:47:17 -06:00
Pat Moroney
92dd947c51 middleware/hosts for /etc/hosts parsing (#695)
* add hosts middleware

* forgot pointer receiver

* add appropriately modified hostsfile tests from golang repo

* remove test artifacts, separate hostsfile parsing from caching and opening, remove unused metrics references, move middleware up the chain

* refactored the logic for creating records and filtering ip address versions. also got PTR lookups working

* Add README.md. Modify config to be more concise. Add zones list to config. Filter PTR responses based on zones list.

* add Fallthrough and return correct dns response code otherwise

* Simplified Hostsfile to only store hosts in the zones we care about, and by ip version. Added handler tests and improved other tests.

* oops, goimports loaded a package from a different repo
2017-06-08 20:48:04 +01:00
John Belamaric
1c53d4130e Add fallthrough support for Kubernetes (#626)
* Add fallthrough support for Kubernetes

This enables registering other services in the same zone as
Kubernetes services. This also re-orders the middleware chain
so that Kubernetes comes before other types, in order to make
this work out-of-the-box.

* Remove extra line
2017-04-19 16:08:30 -04:00
Miek Gieben
830fdfd26d middlewware/startup|shutdown (#604)
Add middleware by directly linking it from caddy, i.e. without any code
changes. To be fair: this does not added a ServeHTTP, but does give
some nice features in the Corefile.
2017-03-18 07:47:01 +00:00
Miek Gieben
bfaf9e0aec core: add more transports (#574)
* core: add listening for other protocols

Allow CoreDNS to listen for TLS request coming over port 853. This can
be enabled with `tls://` in the config file.

Implement listening for grps:// as well.

a Corefile like:

~~~
. tls://.:1853 {
    whoami
    tls
}
~~~

Means we listen on 1853 for tls requests, the `tls` config item allows
configuration for TLS parameters. We *might* be tempted to use Caddy's
Let's Encrypt implementation here.

* Refactor coredns/grpc into CoreDNS

This makes gRPC a first class citizen in CoreDNS. Add defines as being
just another server.

* some cleanups

* unexport the servers

* Move protobuf dir

* Hook up TLS properly

* Fix test

* listen for TLS as well. README updates

* disable test, fix package

* fix test

* Fix tests

* Fix remaining test

* Some tests

* Make the test work

* Add grpc test from #580

* fix crash

* Fix tests

* Close conn

* README cleanups

* README

* link RFC
2017-03-13 20:24:37 +00:00
Miek Gieben
c5224b1048 Golint (#548)
* linter fixes

* Golint and format code

* fmt
2017-02-22 07:25:58 +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
ea38b642b8 All middleware equal (#535)
* all-middleware-equal

* Revert "all-middleware-equal"

This reverts commit ee77b2a981.

* middleware: treat external and local the same

Make the middleware generation simpler and also specify the local
middleware, meaning that it can now be removed as well. Simplify
the code a bit and regen everything.

* remove lineNR, not used
2017-02-19 20:34:29 +00: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
Richard Hillmann
61afc6dbad Add middleware reverse (#452) 2017-02-09 19:39:48 +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