Commit graph

57 commits

Author SHA1 Message Date
Chris O'Haver
6f9a9eb8cd dont load default vals from env (#751) 2017-06-23 18:02:45 -04:00
Miek Gieben
e49ca86ce4 cleanup: go vet and golint run (#736)
* cleanup: go vet and golint run

Various cleanups trickered by go vet and golint.

* Fix tests and lowercase all errors

Lowercase all errors, some tests in kubernetes use errors from
kubernetes which do start with a capital letter.
2017-06-14 09:37:10 -07:00
Chris O'Haver
5c10eba31c handle clusterIP endpoint queries (#730) 2017-06-14 10:29:41 -04:00
Chris O'Haver
930c54ef62 middleware/kubernetes: Implement current federation beta (#723)
* federation initial commit

* UTs/bugfixes

* federation bits

* polish, cover UT gaps

* add TODO

* go fmt & todo note

* remove unrelated change

* pr changes

* start node watcher

* get real node name

* remove unused case
2017-06-14 09:38:00 -04:00
Chris O'Haver
d684dedfd3 unexpose InterfaceAddrser (#693) 2017-06-02 07:25:33 +01:00
Chris O'Haver
d917ff5ac2 Add k8s external service CNAMEs (#677)
* Add external service cnames

* remove cruft

* update CI k8s version

* change CI k8s version

* min k8s ver for ext services

* trying k8s 1.5

* k8s 1.5 requires ports spec

* remove kruft

* update dns schema version
2017-05-30 13:20:39 +01:00
Yong Tang
37050dc217 Some golint cleanup (#674)
This commit fixes some golint issues in `core/dnsserver`
and `middleware/kubernetes`.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-05-25 20:08:34 +01:00
Chris O'Haver
7f950e496a Handle K8s middleware NS record (#662)
* commit for testing in cluster

* commit for testing in cluster

* refactor and add ns.dns record

* Release 007

* reduce heap allocations

* gofmt

* revert accidental Makefile commits

* restore prior rcode for disabled pod mode

* revert Makefile deltas

* add unit tests

* more unit tests

* make isRequestInReverseRange easier to test

* more unit tests

* addressing review feedback

* commit setup.go
2017-05-22 16:05:48 -04:00
John Belamaric
6062e58c59 Remove annoying INFO from k8s middleware (#655) 2017-04-30 08:48:37 +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
12678ac5e2 middleware/kubernetes: doc cleanup (#571)
Set of small cleanups.
2017-03-06 11:42:59 +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
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
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
Chris O'Haver
c62bd639ff correct k8s name parsing response codes (#493) 2017-01-23 20:11:32 +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
Chris OHaver
2d0b8293a4 Add txt response per k8s spec 2017-01-15 14:37:18 +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
Chris O'Haver
0ee88d3007 Add insecure A records for pods (#475) 2017-01-11 21:23:10 +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
Dmytro Kislov
8cb5a05798 Return no items if less than 3 items in service segments 2016-12-14 16:17:14 +00:00
Chris O'Haver
56d3b47d11 Add A lookup for headless services (#451) 2016-12-02 22:50:01 +00:00
John Belamaric
afe4368c34 K8s Test Cleanup and Service PTR
Change the CI setup for K8s to be simpler. Now it just creates a
set of objects via a yaml file, making it very easy to modify
the tests.

Implement PTR for services.
2016-11-15 01:35:24 +00:00
Michael Grosser
ece3cf8ecf Fix various issues with formatting and typos (#424)
* Fix typos

* Simplify code

* Fix error usage
2016-11-13 14:03:12 +00:00
Miek Gieben
651f3938a1 More idiomatic Go 2016-11-11 16:56:15 +00:00
Chris O'Haver
96206cdbc3 Return NXDOMAIN when no items match query (#422)
* When no records match, reply with NXDOMAIN

* Implement in IsNameError

* case for unexposed namespace. k8s integation tests

* Fix imports order. Lower case of err strs.
2016-11-10 21:24:06 +00:00
Miek Gieben
8d3418c015 BackendService: add Reverse method (#381)
Add a Reverse method to BackendService because different backends want
to to do diff. things. This allows etc/k8s to share even more code and
we can unify the PTR handling.
2016-11-05 15:43:27 +00:00
John Belamaric
229c82c418 Fix k8s client (#379)
* Fix k8s client to use client-go

* Fix Kubernetes Build Issue

The client-go code requires you to vendor. I have done a hack here
in the Makefile to vendor it to version 1.5. But looks like we
will need to do this the 'right' way soon.

* Convert v1 to api Objects in List Functions

Also removed the endpoint controller which was not used for anything.
The Watch functions may still need the same treatment.

* Vendor client-go release-1.5

* Fix basic SRV feature

This is actually not serving SRV records correctly, but this should
get it to work as it did prior to the k8s client changes. Another
fix will be needed to serve SRV records as defined in the spec.

* Add additional output in test result

Add the response to the test output.

* Fix erroneous test data
2016-11-05 11:57:08 +00:00
Miek Gieben
27d893cf33 ServiceBackend interface (#369)
* Add ServiceBackend interface

This adds a ServiceBackend interface that is shared between etcd/etcd3
(later) and kubernetes, leading to a massive reduction in code. When
returning the specific records from their backend.

Fixes #273
2016-10-30 15:54:16 +00:00
Manuel Alejandro de Brito Fontes
1b923adde6 Fix k8s build (#373) 2016-10-30 14:58:33 +00:00
John Belamaric
14dc376ee7 Enable use of a service account in-cluster. (#349) 2016-10-19 22:04:35 +01:00
Miek Gieben
aa7744dc86 cleanups: go vet/golint (#331)
Go vet and golint the new code once again.

Drop Name from NameTemplate - it's cleaner: nametemplate.Template.
2016-10-12 12:46:35 +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
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
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
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
Miek Gieben
1c31f1e7f3 remove debug 2016-08-23 17:35:20 +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
9aaeef6376 Moving k8s support scripts out of code folder (#216)
* Adding pod setup to kubernetes startup scripts

* Adding template description to k8s README.md

* Fix typo.

* Moving kubernetes setup scripts out of go folder

* Fixing script error

* Adding messages to k8s scripts for clarity
2016-08-16 09:12:52 -07:00
Michael Richmond
ad2838b916 Adding label selector support to Corefile (#208)
* Adding parsing for label selector to Corefile

* Updating comment typo in k8sCorefile

* Adding implementation of label support to filter exposed objects

* Updating TODO list
2016-08-12 20:44:08 -07:00