Commit graph

38 commits

Author SHA1 Message Date
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
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
219a899772 travis: parallize builds (#947)
* travis: parallize builds

* trying out stuff

* order matters
2017-08-19 17:02:16 +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
1ddafcbdff Makefile cleanup (#903)
Remove unused distclean and misc.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-11 19:47:28 -07:00
Yong Tang
a09f208c51 Add git commit to the version output. (#900)
Now the output would be:
```
 ./coredns -version
CoreDNS-010
linux/amd64, go1.8, 241e3db
```
In case the local file has been modified, then the output would be (with --dirty):
```
 ./coredns -version
CoreDNS-010
linux/amd64, go1.8, 241e3db-dirty
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-11 17:47:37 +01:00
Yong Tang
64353d8f3b Use pre_build hook in docker hub to build the coredns binary (#799)
and skip the download process.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-07-27 14:34:56 -07:00
Miek Gieben
f5fbfce876 Stop vendoring go dns and context (#794)
* Stop vendoring go dns and x/net/context

* dep ensure run

* Fix Makefile

* Fix typo

* Delete context vendor dir
2017-07-26 02:24:01 -07:00
Miek Gieben
30217a4cb2 Drop caddy from vendor (#700)
* Removed caddy

* new stuff

* Now need to go get caddy

* Duh
2017-06-03 08:27:41 +01:00
Chris O'Haver
a4eea61190 fix make lint (#694) 2017-06-02 07:25:00 +01:00
John Belamaric
afec8963c6 Don't check vendor code for gofmt, it takes forever (#661) 2017-05-05 15:33:18 -04:00
Yong Tang
e08fb277fa Add vendor setup with go dep
This fix adds vendor setup with `go dep`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-04-28 09:14:10 -07:00
John Belamaric
4985d698e2 Fix the deps build (#583)
The deps target needs to be dependent on the generated middleware code,
or you end up having to do make twice.
2017-03-13 15:55:44 +00:00
Yong Tang
1e4ba588dc Enforce go lint check and fix several lint issues (#570)
This fix updates the Makefile to add the `go lint` check
for the build. This fix also fixes several go lint issues.

NOTE: This fix does not enforce `go lint` (suggestion only).
This fix also ignores the `go lint` error:
```
middleware/middleware.go:72:1: context.Context should be the first parameter of a function
```
as it requires too many changes in API.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-03-05 14:17:05 -08:00
Miek Gieben
a3f7788686 Put docker release in Makefile.release (#562)
Make the docker release part of the normal CoreDNS release
2017-03-01 15:46:26 +00:00
Yong Tang
43c2fcc1ef Add dependency of go fmt in Makefile (#553)
This fix adds the dependency of `go fmt` in `Makefile`
so that any new check in will have to properly fmt the source code
with `gofmt -s -w`.
2017-02-22 13:28:04 -05:00
John Belamaric
bd033ef6c7 Make go generate run whenever middleware.cfg is changed (#530) 2017-02-16 17:12:19 +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
Bob Wasniak
22e39a072a Allow override of container name (#512) 2017-02-09 18:27:31 +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
Miek Gieben
769d42247e Add docker tagging
Small tweak to tag docker image with current release number.
2016-11-07 14:12:01 +00:00
Miek Gieben
d6902cd7a1 Disable metrics test (#380)
Disable this test (for now), it fails weirdly on travis
(and not locally). Initial suspicion that another server
is still reporting (or something). Anyway hard to replicate
locally - disable it for now.
2016-11-05 14:38:49 +00:00
Miek Gieben
d536272201 middleware/auto: add (#333)
Add auto-load middleware that automatically picks up zones.

Every X seconds it will scan for new zones.
Add tests and documentation.

Make 'make test' use -race.
2016-10-17 18:37:56 +01:00
Yong Tang
9b6b8d2762 Cleanup Makefile and .travis.yml (#305)
This fix updates .travis.yml and Makefile for several places:
- Remove unneeded `docker pull gcr.io/google_containers/hyperkube-amd64:v1.2.4` (only v1.3.7 was used)
- Use docker to deploy etcd (insteadof downloading etcd binary).
- Merge `make testk8s` and `make testk8s-setup` (no need to have multiple targets for a couple of tests)
- Set version of etcd and kubernetes in .travis.yml (so that it is easy to update new version in the future)

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-09-27 07:57:04 +08:00
Yong Tang
6a7db541fa Move .coverage.sh to make coverage (#301)
This fix moves the content of `.coverage.sh` to the Makefile
and creates a target of `make coverage`. This cleans up as
there is really no need to have a redundant script for
simple coverage test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-09-26 07:22:48 +01:00
Miek Gieben
1ad02e8639 Makefile: remove generate (#294)
Fixes #293
2016-09-24 22:47:30 +01:00
Nagy Károly Gábriel
1c6dd35b23 Fixed #253 (#254) 2016-09-12 19:19:31 +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
Miek Gieben
9ac3cab1b7 Make CoreDNS a server type plugin for Caddy (#220)
* Make CoreDNS a server type plugin for Caddy

Remove code we don't need and port all middleware over. Fix all tests
and rework the documentation.

Also make `go generate` build a caddy binary which we then copy into
our directory. This means `go build`-builds remain working as-is.

And new etc instances in each etcd test for better isolation.
Fix more tests and rework test.Server with the newer support Caddy offers.

Fix Makefile to support new mode of operation.
2016-08-19 17:14:17 -07:00
Michael Richmond
6d90b745e0 Switch over to k8s notification API (#202)
* Merge notification code by @aledbf and update for recent changes.
* Fix travis environment to correctly build with k8s.io and forked repositories.
* Refactored kubernetes Corefile parser
* Added lots of Corefile parsing tests
2016-08-05 18:19:51 -07:00
Michael Richmond
8dec292668 Fix Travis IPv6 and add k8s integration testing to CI (#194)
Updating travis yaml file to:
* Force IPv6 to work in their VM environment
* Enable docker (requires VM environment and sudo)
* Run kubernetes integration tests in Travis
2016-07-27 10:01:24 -07:00
Michael Richmond
3f4ec783d2 Adding wildcard support (#190)
* Commenting out unused functions. TODO: remove when it is not needed

* Update README with namespace and template example

* Adding note about changing the record name format via a template

* Adding test scripts to automate k8s startup

* Automating k8s namespace creation

* Adding automation to start 4 k8s services

* Updating documentation for k8s tests

* Avoid downloading kubectl if already exists

* Adding debug statement when namespace is not exposed.

* Adding basic kubernetes integration tests

* Makefile now contains a "testk8s" target. This target requires k8s to
  be running.
* Adding test/kubernetes_test.go file with a couple of basic A record
  tests.

* Updating k8s integration tests to only run k8s integration tests

* Adding support for namespace wildcards

* Refactoring to move filtering logic to kubernetes.go file

* go fmt fixes

* Adding wildcard support for namespaces and service names

* Kubernetes integration tests updated for A records.
* Expanded record name assembly for answer section not yet implemented.
* Refactoring to focus k8sclient code just on accessing k8s API.
 Filtering now handled in kubernetes.go

* Adding wildcard test cases

* Adding skydns startup script. (To allow side by side testing of wildcards.)
* Commenting out record name assmebly based on NameTemplate. Need to improve template before this makes sense.

* Adding basic SRV integration tests

* Need to add verification for additional answer section

* Fixing comments and formatting

* Moving wildcard constants to vars

* Travis test execution appears to be failing on access to these
 constants

* Fixing access to util package

* Trying to work around Travis test bug

* Reverting to access kubernetes/util as "util"

Travis breakage is due to "Infoblox-CTO" in src path
2016-07-14 23:50:14 +02:00
Michael Richmond
289f53d386 k8s middleware cleanup, testcases, basic SRV (#181)
* Removing unnecessary gitignore pattern

* Updating Makefile to run unittests for subpackages

* Adding Corefile validation to ignore overlapping zones

* Fixing SRV query handling

* Updating README.md now that SRV works

* Fixing debug message, adding code comment

* Clarifying implementation of zone normalization

* "Overlapping zones" is ill-defined. Reimplemented zone overlap/subzone
  checking to contain these functions in k8s middleware and provide
  better code comments explaining the normalization.

* Separate build verbosity from test verbosity

* Cleaning up comments to match repo code style

* Merging warning messages into single message
* Moving function docs to before function declaration

* Adding test cases for k8sclient connector

* Tests cover connector create and setting base url
* Fixed bugs in connector create and setting base url functions

* Updaing README to group and order development work

* Priority focused on achieving functional parity with SkyDNS.

* Adding work items to README and cleaning up formatting

* More README format cleaning

* List formating

* Refactoring k8s API call to allow dependency injection

* Add test cases for data parsing from k8s into dataobject structures

* URL is dependency-injected to allow replacement with a mock http
  server during test execution

* Adding more data validation for JSON parsing tests

* Adding test case for GetResourceList()

* Adding notes about SkyDNS embedded IP and port record names

* Marked test case implemented.

* Fixing formatting for example command.

* Fixing formatting

* Adding notes about Docker image building.

* Adding SkyDNS work item

* Updating TODO list

* Adding name template to Corefile to specify how k8s record names are assembled

* Adding template support for multi-segment zones

* Updating example CoreFile for k8s with template comment

* Misc whitespace cleanup

* Adding SkyDNS naming notes

* Adding namespace filtering to CoreFile config

* Updating example k8sCoreFile to specify namespaces

* Removing unused codepath

* Adding check for valid namespace

* More README TODO restructuring to focus effort

* Adding template validation while parsing CoreFile

* Record name template is considered invalid if it contains a symbol of the form ${bar} where the symbol
  "${bar}" is not an accepted template symbol.

* Refactoring generation of answer records

* Parse typeName out of query string
* Refactor answer record creation as operation over list of ServiceItems

* Moving k8s API caching into SkyDNS equivalency segment

* Adding function to assemble record names from template

* Warning: This commit may be broken. Syncing to get laptop code over to dev machine.

* More todo notes

* Adding comment describing sample test data.

* Update k8sCorefile

* Adding comment

* Adding filtering support for kubernetes "type"

* Required refactoring to support reuse of the StringInSlice function.

* Cleaning up formatting

* Adding note about SkyDNS supporting word "any".

* baseUrl -> baseURL

* Also removed debug statement from core/setup/kubernetes.go

* Fixing test breaking from Url -> URL naming changes

* Changing record name template language ${...} -> {...}

* Fix formatting with go fmt

* Updating all k8sclient data getters to return error value

* Adding error message to k8sclient data accessors

* Cleaning up setup for kubernetes

* Removed verbose nils in initial k8s middleware instance
* Set reasonable defaults if CoreFile has no parameters in the
kubernetes block. (k8s endpoint, and name template)

* Formatting cleanup -- go fmt
2016-07-07 09:40:58 +01:00
Michael Richmond
d04abdf422 BK8s datasource middleware -- PoC for A records (#153)
* Laying down kubernetes middleware foundation

* Duplicated a bunch of code form etcd middleware
* Duplicated code hacked to compile and load as a separate middleware

* Adding verbose build option to Makefile

* Removing stubzone and tls support

tls and stubzone support was carried over from base etcd middleware code.
Removing to simplify the kube middleware implementation. (For now.)

* Adding conf directory for sample conf files

* Removing stubzone support from query handler

* Remove upstream and proxy from k8s corefile.

Not sure that upstream or proxy makes sense for a k8s backed zone.

* Comment out use of singleflight serialization

* Removing parsing support for "upstream" directive from k8s

* Removing upstream directive parsing code

* Removing CNAME and TXT lookup implementation

* Create README.md

Brain-dump of DNS record name assembly and open work items.

* Adding notes about wildcard handling

* Adding basic k8s API client

* Fleshing out methods on k8s connector

* Remove PathPrefix from middleware init

* Removing incorrect plural

* Adding brute-force k8s service lookup functions

* Initializing k8s API connector during startup

* Hacking around to call k8s connector

* Parsing incoming domain name into serviceName and namespace

* Improving and simplifying k8s zone matching and label segmentation

* Removing unused functions carried over from etcd middleware

* Adding basic return of k8s data to DNS client

* updated debugging println statements to flag with "[debug]"
* removed code in kubernetes.go::Records that was a hold-over from etcd middleware.
* Removed some random exploratory hacking.

* Minior README.md updates

* Updating with demo instructions

* Updating README.md with CoreFile and removing completed TODO items

* Updating conf file and README to reflect DNS response cache works

* Disabling DNS response caching

* Adding debug statement on entry to Records()

* Changing port number in exampes to port 53.

* Misc style and clarity changes

* Removing empty function definitions

* Adding comment to track future cleanup

* Refactoring README to follow style of other middleware

* Exposing dataobject field (typo)
2016-06-06 20:49:53 +01:00
Michael Richmond
e34280e7af Clean up remove caddy refs (#139)
* Changed reference to Caddy over to CoreDNS

* Removing references to caddy

* Fixed misleading error message to reference coredns

* Cleaning up references to caddy

* Adding clean and deps targets

Muscle memory is resulting in "make clean" commands.

* Adding test target to makefile

* More "Caddy" cleanup
2016-04-28 19:07:44 +01:00
Miek Gieben
da447e28f4 Add Dockerfile (#116)
Add some docker bits and a Makefile.
2016-04-13 20:14:13 +01:00