Commit graph

223 commits

Author SHA1 Message Date
Miek Gieben
cc486fb900 middleware/file: transfer from does not make sense (#314)
Make it return an error when you use `transfer from` when you're
not a secondary.

Add tests as well.

Fixes #310
2016-10-02 19:41:00 +01:00
Miek Gieben
4096c4906d Pr 311 2 (#312)
* Add a setup test for middleware/file

This fix adds a setup test for middleware/file so that there is
a basic coverage for the Corefile processing of middleware/file.

This fix is related to 308 (Will look into it).

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

* middleware/file: use helper function for test

Fixup setup_test.go and use the test.TempFile function to make things
somewhat shorter.

Use clean up the use of testing.T in TempFile - it is not used.
2016-10-02 15:58:01 +01:00
Miek Gieben
e54c232c8c middleware/cache: split cache in positive and negative and use lru (#298)
Make the cache memory bounded, by using a LRU cache. Also split the
cache in a positive and negative one - each with its own controls.

Extend the cache stanza to allow for this:

    cache {
       positive limit [ttl]
       negative limit [ttl]
    }

is now possible. This also add a cache_test.go in the toplevel test/
directory that exercises the caching path.

Fixes #260
2016-10-02 08:31:44 +01:00
Miek Gieben
77947fd51a middleware/etcd: add setup_test.go (#304)
Add tests for parsing etcd Corefile stanza. Discover a bug in the code,
fix that as well.
2016-09-26 14:43:38 +01:00
Miek Gieben
de0fa53379 Doc: add package docs (#296)
* Doc: add package docs

Add short package level docs to make godoc looks nicer.
Add some badges to the README.

* correct url
2016-09-25 08:39:20 +01:00
Miek Gieben
edc867fe56 middleware/metrics: fix crash (#295)
Fix the crash and add `setup_test.go` to catch this in the future.

Fixes #292
2016-09-24 22:47:38 +01:00
Silas Baronda
ec485a74d3 Nil SOA causes panic if we compare it to incoming SOA (#291) 2016-09-24 15:51:20 +01:00
Chris O'Haver
15297c8e63 Add TLS support for k8s middleware (#289)
* Added TLS to k8s client

Added options for TLS kubernetes client connection.

* Fix k8s TLS config option parsing

Brings config option parsing for kubernetes TLS in line with recent changes.

* Put TLS config on one line

Put kubernetes tls config on one line to match style established in etcd tls config.

* Add tls option to README
2016-09-23 23:07:06 +01:00
Yong Tang
b9cf32f7a9 Golint middleware/proxy (#290)
While looking into the proxy middleware it appears that there are
several golint messages:
```
ubuntu@ubuntu:~/coredns$ golint middleware/proxy/
middleware/proxy/lookup.go:66:1: exported method Proxy.Forward should have comment or be unexported
middleware/proxy/proxy.go:24:6: exported type Client should have comment or be unexported
middleware/proxy/proxy.go:107:1: exported function Clients should have comment or be unexported
middleware/proxy/reverseproxy.go:10:6: exported type ReverseProxy should have comment or be unexported
middleware/proxy/reverseproxy.go:16:1: exported method ReverseProxy.ServeDNS should have comment or be unexported
middleware/proxy/upstream.go:42:6: exported type Options should have comment or be unexported
```

This fix addressed the above golint messages.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-09-23 23:00:50 +01:00
Manuel de Brito Fontes
1810e21b9a Lint k8s middleware 2016-09-23 11:08:23 -03:00
Manuel de Brito Fontes
8e6257c51f Lister refactor kubernetes/kubernetes#33269 2016-09-23 10:23:11 -03:00
Manuel de Brito Fontes
6e0944eb98 Remove unused const block 2016-09-23 10:03:43 -03:00
Manuel de Brito Fontes
2b62384223 Refactoring of k8s helpers 2016-09-23 09:48:11 -03:00
Miek Gieben
090d1872e9 Golint2 (#280)
* Fix linter errors

* More linting fixes

* More docs and making members private that dont need to be public

* Fix linter errors

* More linting fixes

* More docs and making members private that dont need to be public

* More lint fixes

This leaves:

~~~
middleware/kubernetes/nametemplate/nametemplate.go:64:6: exported type NameTemplate should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:71:1: exported method NameTemplate.SetTemplate should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:108:1: exported method NameTemplate.GetZoneFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:116:1: exported method NameTemplate.GetNamespaceFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:120:1: exported method NameTemplate.GetServiceFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:124:1: exported method NameTemplate.GetTypeFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:135:1: exported method NameTemplate.GetSymbolFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:167:1: exported method NameTemplate.IsValid should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:182:6: exported type NameValues should have comment or be unexported
middleware/kubernetes/util/util.go:1:1: package comment should be of the form "Package util ..."
middleware/kubernetes/util/util.go:27:2: exported const WildcardStar should have comment (or a comment on this block) or be unexported
middleware/proxy/lookup.go:66:1: exported method Proxy.Forward should have comment or be unexported
middleware/proxy/proxy.go:24:6: exported type Client should have comment or be unexported
middleware/proxy/proxy.go:107:1: exported function Clients should have comment or be unexported
middleware/proxy/reverseproxy.go:10:6: exported type ReverseProxy should have comment or be unexported
middleware/proxy/reverseproxy.go:16:1: exported method ReverseProxy.ServeDNS should have comment or be unexported
middleware/proxy/upstream.go:42:6: exported type Options should have comment or be unexported
~~~

I plan on reworking the proxy anyway, so I'll leave that be.
2016-09-23 09:14:12 +01:00
Manuel de Brito Fontes
3be9e58ddf Revert k8s changes 2016-09-22 08:29:50 -03:00
Manuel Alejandro de Brito Fontes
d250742d9e Fix k8s build (#278) 2016-09-21 20:05:18 +01:00
Miek Gieben
5301c5af5f Run golint and go vet (#276)
Cleanup the errors and removed deadcode along the way. The leaves
some error laying around, mostly about commenting exported identifier.
We should look hard if those really are needed.
2016-09-21 17:01:19 +01:00
Miek Gieben
8555716046 Cleanups and tests (#272)
For some reasons there was a dnsserver/middleware.go that defined
the middleware handlers. This code was a repeat from
middleware/middleware.go. Removed dnsserver/middleware.go and replaced
all uses of dnsserver.Middleware with middleware.Middleware.

Added dnsserver/address_test.go to test the zone normalization (and to
improve the test coverage). The deleted file will also improve the test
coverage :)
2016-09-19 11:26:00 +01:00
Shawn Smith
1decf52cb2 fix typo (#268) 2016-09-18 15:33:09 +01:00
Miek Gieben
b440b1c8f6 docs: document default startup (#266)
Some small additions to the documentation.
2016-09-18 09:32:06 +01:00
Miek Gieben
80b22a5071 middleware/whois: hook it up
Hook it up properly by adding it to the directives list. And add
the Target to the SRV record to actually return valid DNS messages.
2016-09-17 17:50:16 +01:00
Miek Gieben
30fd224504 middleware/whoami: add (#264)
Add a new middleware that tells you who you are; IP, port and transport
is echoed back.

Also some various cleanup and documentation improvements while at it:

* ResponseWriter: improve the documentation of these helper functions.
* And add an NextHandler for use in tests. Make chaos_test.go and
* whoam_test.go use it.
2016-09-17 17:09:05 +01:00
Yong Tang
ed907d3327 Fix proxy upstream parser issue and add test cases (#263)
This fix tries to fix 261 where proxy upstream parser is not
able to parse upstream correctly.

Several test cases have also been added to cover the changes
and prevent regression in the future.

This fix fixes 261.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-09-17 07:49:35 +01:00
Yong Tang
50d47a55a2 Fix build error by change kubernetes controller to pkg/client/cache (#262)
Kubernetes moves informer and controller to pkg/client/cache, see:
https://github.com/kubernetes/kubernetes/pull/32718

As a result, coredns build is broken.

This fix fixes the build by making related change with kubernetes.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-09-16 16:31:23 +01:00
Yong Tang
953cfc1de4 Remove lumberjack logger (#257)
* Removed lumberjack from coremain

As is mentioned in 251, this fix removed lumberjack from coremain.

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

* Remove lumberjack from log middleware

As mentioned in 251, lumberjack is not suitable for applications like CoreDNS
so it is removed from the log middleware.

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

* Update log/README.md as lumberjack has been removed

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

* Adjust default log output from `ioutil.Discard` to `os.Stdout`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-09-16 15:50:16 +01:00
Miek Gieben
2dd8a687b3 Startup notification (#250)
Stop the caddy message and start our own init notifications.
Log the version of CoreDNS when starting up.
Fix all middleware's setup functions so that return the error prefixed
with *which* middleware was failing; leads to better debuggable errors
when starting up.
2016-09-10 09:16:25 +01:00
Miek Gieben
5216ab6b58 Add tests for normalize.go
Fix some of the documentation in the process.
2016-09-07 12:55:41 +00:00
Miek Gieben
d1f17fa7e0 Cleanup: put middleware helper functions in pkgs (#245)
Move all (almost all) Go files in middleware into their
own packages. This makes for better naming and discoverability.

Lot of changes elsewhere to make this change.

The middleware.State was renamed to request.Request which is better,
but still does not cover all use-cases. It was also moved out middleware
because it is used by `dnsserver` as well.

A pkg/dnsutil packages was added for shared, handy, dns util functions.

All normalize functions are now put in normalize.go
2016-09-07 11:10:16 +01:00
Yong Tang
684330fd28 Add a test for health middleware (#246)
This commit adds a simple test of `TestHealth` for the middleware
of health so that there is basic coverage.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-09-07 10:01:27 +01:00
Miek Gieben
eea77cc97c Fs (#242)
* play around with fs idea

* docs and fix test

* better docs
2016-09-05 09:32:11 +01:00
Miek Gieben
99170ac62e Better logging for NSEC3
When dropping NSEC3 records provide better logging and add test
for NSEC3 records.
2016-09-03 09:37:36 +01:00
Miek Gieben
9caa607173 Update docs
Update the file and dnssec docs and glarify what is implement and that
we only do NSEC.
2016-08-29 19:15:04 +01:00
Miek Gieben
676dc919a2 Remove conf/ dir
Adjust documentation for k8s and put contents of the k8sCorefile
in the README.md
2016-08-25 07:35:09 +01:00
Miek Gieben
1c31f1e7f3 remove debug 2016-08-23 17:35:20 +01:00
Miek Gieben
47f4e165a0 Fix main startup (#232)
Set version and name of the program. And then call coremain.Run().

The coremain split makes CoreDNS embeddable.

Also see #189 for an old PR.
2016-08-23 16:36:29 +01:00
Michael Richmond
2153d2defd Fix k8s integration tests (#231)
* Adding debug message when starting k8s controller

* Adding work-around for timing issue in k8s integration tests

* Remove unused import

* Fix Makefile for ast package

* Increase k8s verbosity in travis

* Updating TODO list to find root cause of test issue

* go fmt cleanup
2016-08-23 07:15:21 +01:00
cricketliu
938ecbeab9 Update README.md
Grammatical fixes.
2016-08-22 14:40:24 -07:00
cricketliu
9a3fa013d6 Update README.md
Grammatical fixes.
2016-08-22 14:38:33 -07:00
cricketliu
af6ebb7cd9 Update README.md
Grammatical fixes.
2016-08-22 14:33:40 -07:00
cricketliu
6b1d816d5a Update README.md
Grammatical fixes.
2016-08-22 14:29:50 -07:00
cricketliu
62a845ca2a Update README.md
Grammatical fixes.
2016-08-22 14:27:55 -07:00
cricketliu
e0493e898b Update README.md
Grammatical fixes.
2016-08-22 14:25:19 -07:00
cricketliu
58a63f53aa Update README.md
Grammatical fixes.
2016-08-22 14:24:02 -07:00
cricketliu
bfb89d8dba Update README.md
Grammatical fixes.
2016-08-22 14:17:21 -07:00
cricketliu
052387b705 Update README.md
Grammatical fixes.
2016-08-22 14:12:03 -07:00
cricketliu
428c99b7a0 Update README.md
Grammatical fixes plus correction of the reverse-mapping zone for 10.0.0/24.
2016-08-22 14:10:25 -07:00
cricketliu
2666ca7238 Update README.md
Grammatical fixes.
2016-08-22 14:05:56 -07:00
cricketliu
5325dadb7c Update README.md 2016-08-22 14:04:21 -07:00
cricketliu
d51c7baefb Update README.md
Grammatical fixes.
2016-08-22 13:53:00 -07:00
cricketliu
2ad57f0804 Update README.md
More grammatical fixes.
2016-08-22 13:51:54 -07:00