Commit graph

788 commits

Author SHA1 Message Date
Yong Tang
53d9b52d68 Update DockerHub build hook with golang 1.9 (#998)
To align with #992

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-26 17:47:43 -07:00
Miek Gieben
4049ed4f4b mw/kubernetes: add configurable TTL (#995)
* mw/kubernetes: add configurable TTL

Add ttl option to kubernetes. This defaults to 5s but allows
configuration to go up to 3600.

Configure the tests so that a few actually check for the 5s, while the
rest use the TTL of 303 which is ignored by the checking code.

Fixes #935

* fix tests

* and more
2017-08-26 17:32:46 -07:00
Yong Tang
01f6e8cba5 Cleanup in go vet and misspell (#996)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-26 17:32:16 -07:00
Miek Gieben
1bb836b793 mw/health: add reload test (#980)
Start CoreDNS instance in call Restart() on it.
2017-08-26 17:39:43 +01:00
Miek Gieben
afad8abef3 travis: enable go 1.9 (#992) 2017-08-26 17:05:56 +01:00
varyoo
d5b636bca6 changes in Caddy caused mw/root tests to fail: 4cce8c7b6b (#990) 2017-08-26 16:58:04 +01:00
Yong Tang
3a9cb4fcf8 Reduce the test cases for kubernetes API proxy (#989)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-25 11:04:21 -07:00
Miek Gieben
55dafe6f59 core: block CH queries earlier (#973)
block chaos queries, unless the chaos or proxy middleware is loaded. We
respond with REFUSED.

This removes the need for each middleware to do this class != ClassINET
if-then.

Also make config.Registry non-public.
2017-08-25 08:55:53 +01:00
Miek Gieben
932639ac99 Remove createTestServer (#981)
* Remove createTestServer

* more cleanups

* comment tweak

* sort

* sigh
2017-08-24 20:59:27 +01:00
Miek Gieben
e06863d2be mw/kubernetes: split up tests cases (#971)
Split up the handler_test in four files that all tests their specific
bits. Removed the CNAME sort as there was only 1 answer with a CNAME
and that was a single one.

See #942, this fixes (a bit) the tests in middleware.
2017-08-24 19:42:45 +01:00
Thong Huynh
3f05f7e6c0 Add set EDNS0 with variable substitution (#937)
* Add set EDNS0 with variable substitution

* Change variable from $ to {}. Un-export constants

* Update README

* Change getRuleData() to ruleData(); Change to use string match from regexp
2017-08-24 17:34:07 +01:00
Sandeep Rajan
5e9991556e Middleware/Kubernetes: Add RR check to K8s integration tests (#884) 2017-08-24 11:05:16 -04:00
Miek Gieben
f901b0cefa tests: CoreDNSServerAndPorts (#972)
* tests: CoreDNSServerAndPorts

Copy from kubernetes.go and renamed to fit the style, adapted almost
all callers.

This is a mechanicl change, no testdata was changed.

* typos
2017-08-24 11:35:14 +01:00
Miek Gieben
ea53f8c219 auto: test (#978)
Increate the sleep duration; this is not a proper fix. The problem here
is that this is in test that just starts a CoreDNS instance and thus we
don't have levers to make "time speed up". It might be worth checking if
there is some LD_PRELOAD hackery that fakes time for the entire test?

Fixes #945 (not really, but closing with this)
2017-08-24 09:18:27 +01:00
Miek Gieben
9c62ddaa01 Small golint cleanup (#977)
* Small golint cleanup

Mostly docs in autopath.

* duh
2017-08-24 08:56:48 +01:00
Miek Gieben
10b7221067 mw/kubernetes: revert if-else for health (#970)
Do the return early and dedent the rest of the function.
2017-08-23 08:30:19 -07:00
Miek Gieben
4b105c761e Parse fix (#974)
* mw/kubernetes: add apex test

This adds small test case for apex queries: SOA and HINFO.

Fix (obvious) parse bug in parse.go.

* Test Ns request also here
2017-08-23 14:07:10 +01:00
Miek Gieben
61fc672e19 mw/kubernetes: remove kPod and kServices (#969)
Based up on: #939, but redone in a new PR with some cherry-picked
commits:
aacb91ef0b
5dc34247b7

This removes kPod and Kservice and creates []msg.Service from k.findPods
and k.findServices.

Updated few tests which I *think* are correct; they look correct to me.
2017-08-23 07:19:41 +01:00
Miek Gieben
7f5086e97a mw/kubernetes: don't export Pod-mode constants. (#959)
* mw/kubernetes: don't export Pod-mode constants.

* merged
2017-08-22 22:11:48 +01:00
Miek Gieben
12db6618c8 mw/kubernetes: resync to opts (#957)
* mw/kubernetes: resync to opts

Only used to initialize the cache that already has a dnsControlopts, so
remove it from the main kubernetes struct.

* Fix test

* mw/kubernetes: LabelSelector to options as well

Labels select is also only used for init. Don't carry it in the main
kubernetes struct.

* remove this test: can't happen

Caddyfile parser will only call setup when it sees kubernetes.

* erge gone wrong
2017-08-22 21:52:18 +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
60d5e71a1a mw/*: updates docs about upstream (#968)
Upstream allows file structured like /etc/resolv.conf. Update docs.

Fixes #709
2017-08-22 14:56:00 +01:00
Miek Gieben
5604568655 mw/auto: increate setup coverage (#967)
Fixes #965
2017-08-22 14:52:20 +01:00
Miek Gieben
8931ede142 core: hide registerHandler (#964)
* core: hide registerHandler

Remove RegisterHandler and just make it implicit when we look at the
handler compilation step.

* Rename GetHandler to just Handler

Update callers and make auto check Hander in OnStartup.

* Up test coverage in erratic

* up test coverage
2017-08-22 14:21:42 +01:00
Miek Gieben
65009b5578 mw/autopath: a minimal bug section (#961)
Briefly highlight that autopath might return the wrong results to pods
in different namespaces.

Fixes #778
2017-08-21 08:57:54 +01:00
Miek Gieben
fe75e1b6f9 mw/file: add include test (#960)
$INCLUDE was fixed in miekg/dns, create tests in CoreDNS so that we know
we have the latest version.

Fixes #880
2017-08-21 08:20:17 +01:00
Miek Gieben
0a80ca7dba travis: drop 1.7 (#956)
Yes, the previous Go version is important but this doubles the wait on
travis. This drops 1.7 from travis. This means we wait for bug reports
to show up, or tell people to use the precompiled binaries are docker
containers.
2017-08-20 00:40:06 +01:00
Yong Tang
9068f4f565 Use go test -i to install all prerequisite packages (#954)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-19 22:14:44 +01:00
Yong Tang
a682f73b5c Disable Travis cache (#953)
It looks like the cached path
- `$GOPATH/src`
- `$GOPATH/pkg`
overlaps with the source path of
`$GOPATH/src/github.com/coredns/coredns`.

Disable the cache for now.

May enable cache in the future if we could exclude
`$GOPATH/src/github.com/coredns/coredns` from `$GOPATH/src`.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-19 20:47:48 +01:00
Yong Tang
8749b870c4 Use date instead of time as time might be reserved word in sh. (#952)
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-19 12:18:56 -07:00
Yong Tang
ee14993f7d Add time in coverage test (#951)
For profiling the time spent in Travis CI.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-19 20:02:43 +01:00
Miek Gieben
60c83fefac travis: remove -bench and -race from coverage (#949)
Not needed and already done in the other test (bench is not looked at
at all)
2017-08-19 17:53:31 +01:00
Miek Gieben
87eb0d39a4 Move nonwriter to mw/pkg/nonwriter (#948)
Make it its own package as shared between autopath and federation.

Fixes #933
2017-08-19 17:28:42 +01:00
Miek Gieben
219a899772 travis: parallize builds (#947)
* travis: parallize builds

* trying out stuff

* order matters
2017-08-19 17:02:16 +01:00
Miek Gieben
02955d7594 Dns.join (#944)
* Add dnsutil.Join

* Create dnsutil.Join

Create Join helper function and move bits in the code over.
2017-08-19 15:22:09 +01:00
Miek Gieben
7c343982a6 backend.Records make it take request.Request (#943)
This is more general and aligns well with the other methods.
Also allows the kubernetes middleware to use it.

Fixes #940
2017-08-19 14:03:03 +01:00
Miek Gieben
627687b11f mw/kubernetes: remove zone from parseRequest (#938)
* mw/kubernetes: remove zone from parseRequest

State has the zone info as well, so don't need to have it in
parseRequest anymore.

* Fix up tests

* improve test coverage
2017-08-19 07:18:35 +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
cc4e4a0626 mw/autopath: integration test with erratic (#930)
Add integration test with erratic. For this erratic now also returns an
autopath searchpath. This tests the whole chain; i.e registring a
searchfunction and calling that from autopath.

This tests does a autopathing domain and a non-autopathing one.
2017-08-18 12:57:23 +01:00
Miek Gieben
5a1875120c mw/kubernetes: add reverse test case (#932)
Add a non-arpa testcase to the reverse test.
2017-08-17 18:42:14 +01:00
Miek Gieben
7f46df6d27 tests: add SortAndCheck helper (#926)
There was quite some code duplication in a lot of tests to check if
an answer was considered Ok. Created a test.SortAndCheck helper function
that takes care of this.
2017-08-16 15:30:58 +01:00
John Belamaric
65b56248f0 Remove use of hostnames in upstreams (#927)
Only IP:Port or file name is allowed.
2017-08-16 10:00:32 -04:00
Miek Gieben
06644c2855 mw/kubernetes: add reverse_test.go (#922)
This PR adds a reverse tests that copies some of it from the main
integration test. This aids in local testing because you don't need
a full k8s setup running.

It does the most minimal testing, a successful return and a nodata
response that includes the SOA for in-addr.arpa.
2017-08-16 07:33:35 +01:00
Miek Gieben
479c8bbaa9 Reverse in k8s (#923)
* mw/kubernetes: reverse zone in ZONE stanza not parsed

Properly parse the reverse zone syntax in the ZONES stanza as promised
in the README.

As short test case to test.

* add test
2017-08-16 07:29:46 +01:00
insomniac
1ab8b37e7e Make CoreDNS build on Go 1.7 (#919) 2017-08-14 13:51:18 -07: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
818d2b10ad cidr everywhere: check all middleware (#915)
* cidr everywhere: check all middleware

Add tests for cidr in only that middleware that already tests for this.
Check the other ones manually (and put reverse in the tests cases
anyway).

Make etcd setup_test run without +build etcd tag - it is not needed
for this test - move rest of the code to lookup_test.go.

Cleanup proxy test a bit and remove TempDir as there is test.TempFile
that does the same thing.

Fixes #909

* coredns package

* Fix test compile
2017-08-13 18:16:25 +01:00
Yong Tang
0c02708d63 Consolidation of Makefile and Makefile.release (#912)
* Consolidation of Makefile and Makefile.release

Several changes:
1. All go specific target like `go generate`, etc. has
been moved to Makefile. Now Makefile.release does not
repeat go build, etc. related rules.
2. In Makefile.release, the binary build is done through
`docker run` and with a fixed specific go version (currently 1.8.3).
This will help making sure build process could be reproduced
on any dev platform, with no dependency to the golang version
installed on the platform.
3. Platform related flags (e.g., "GOOS=darwin") are passed through
Makefile (not Makefile.release).

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

* Update to only use `make` without running inside `docker run`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-13 17:41:50 +01:00
Yong Tang
8d876c770c Use logo as the title of the README.md (#911)
The logo is pointing to https://coredns.io/images/CoreDNS_Colour_Horizontal.png
and provides the link to https://coredns.io

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-13 07:34:56 +01:00
Yong Tang
c0d435d4e8 Fix log output of the version string. (#910)
Split version string into two, before:
```
2017/08/12 19:43:08 [INFO] CoreDNS-010
linux/amd64, go1.8.3, a6d2d7b5
CoreDNS-010
linux/amd64, go1.8.3, a6d2d7b5
```
After:
```
root@9bd51ffc39aa:/go/src/github.com/coredns/coredns# ./coredns
.:53
2017/08/12 19:12:59 [INFO] CoreDNS-010
2017/08/12 19:12:59 [INFO] linux/amd64, go1.8, a6d2d7b
CoreDNS-010
linux/amd64, go1.8, a6d2d7b
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-12 20:59:28 +01:00