Commit graph

123 commits

Author SHA1 Message Date
Miek Gieben
6cc3f47d46 middleware/authpath: Fix return from k8s mw (#871)
* middleware/authpath: Fix return from k8s mw

Return the correct search path from the kubernetes' AutoPath function.
Based on preliminary discussion in #870

* PodWithIP can be private

Fix and add docs to functions.

* CR: remove the error from AutoPathFunc
2017-08-10 19:26:31 +01:00
Miek Gieben
28447234b1 mw/kubernetes: fix parseTests (#875)
* mw/kubernetes: fix parseTests

Make parse tests table driven to remove a duplicate code, i.e. most
of the contents of parse_test.go can be removed as well as the
expectString helper function.

* cleanup parse tests
2017-08-10 02:23:27 -07:00
Miek Gieben
7e56cc74e5 WIP: Parserequest2 cutback (#868)
* middleware/kubernetes: pull TXT out of parseRequest

Put the TXT handling one layer higher and remove it from parseRequest.
Also rename the podsvc field in there to podOrSvc. Now that it isn't
used anymore for TXT record (dns-version) that was put in there. We can
make this a boolean (in a future PR).

Make parseRequest get an optional Zone that is from state.Zone and use
that instead of its own code. Removed some tests and other smaller
cleanups.

Fixes #836

* add this reverse

* another check

* readd

* Rename to kPod and kService for some clarity
2017-08-10 01:08:58 -07:00
Miek Gieben
df1879f9ae middleware/kubernetes: put reverse function in own file (#863)
Move reverse function and (some) test code to reverse*.go
2017-08-09 05:18:46 -07:00
Miek Gieben
be037a32a5 mw/kubernetes: restore handler to pre-autopath state (#861)
Pull in the contents of routeRequest as it is only called once.
2017-08-09 04:09:37 -07:00
Miek Gieben
b8e2c476a5 mw/authpath: hook in kubernetees (#860)
Call out to kubernetes to get the search path - this still needs
to return something sensible, but all infrastructure has landed
to make it work.
2017-08-09 04:06:48 -07:00
Miek Gieben
b46b9880bd WIP: autopath as middleware (#859)
autopath as middleware
2017-08-09 03:13:38 -07:00
Miek Gieben
c3705ec68c mw/kubernetes: warn about deprecating cidr (#858)
Add log statement pointing to replacement.
remove cidr from README and use replacement syntax.

Fixes #851
2017-08-08 05:05:34 -07:00
Miek Gieben
0bc1ff7408 mw/kubernetes: autopath refactors (#850)
Factor out as much of autopath into a subpackage as possible right now.
apw.Sent is not needed, we should see this from the rcode returned by
the middleware. See #852 on why this was needed.

Disable the tests for now as to not break the main build.
2017-08-07 14:45:30 -07:00
Miek Gieben
760e667063 middleware/kubernetes: autopath in sub package (#848)
Put the autopath stuff in a separate sub package. Tests are still
included in the main kubernetes directory.

Next steps (after this is merged), is pulling the autopath handling
into the subpackage and fixing the tests.
2017-08-07 07:09:32 -07:00
Miek Gieben
bcb2eb1ecc all: gometalinter (#843)
* kubernetes/reverse: remove deadcode
* deadcode in errors and kubernetes removed
* unnecessary conversion
* constants
* proxy: time.Since()
* simplications
* static check
* Disable test/external_test
2017-08-06 05:54:24 -07:00
Miek Gieben
c84df38ac5 middleware/kubernetes: fixes (#837)
dedent code, use shorter names.
use strings.EqualFold instead ToLower to avoid create garbage.
2017-08-05 12:29:43 -07:00
Miek Gieben
b11cf7c2bc not used anymore (#832) 2017-08-04 16:03:30 -07:00
Yong Tang
7ca018374f golint cleanup (#828)
Clean up some golint related issues.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-04 09:46:40 -07:00
Yong Tang
c08497adee Misspell correction (#826)
Did a `misspell . | grep -v ^vendor` and fixed
several typos.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-04 09:06:06 -07:00
Miek Gieben
21386ebdd5 middleware/kubernetes: define consts (#824)
Define two consts Pod and Svc, makes it stand out a little more
when used in switches in case.

We have opted for a new type, but then you need to convert them
all the time with string(Foo).
2017-08-04 10:34:00 -04:00
Markus Sommer
d0d7f4c89a Kubernetes srv (#823)
* Treat absence of port/service in SRV as wildcard

Normally, a SRV-request should have the form
_<service>._<port>.<name>.<zone>. The k8s peer-finder which is used for
bootstrapping by some applications will however query for SRV at
<name>.<zone>.

To compensate for this behaviour, treat the absence of _<service> and
_<port> as wildcards.

* Modified tests with new SRV behaviour

Added a testcase for a SRV request without port & service
Removed now valid query from invalidSRVQueries

* Forgot to run gofmt on test/kubernetes_test.go
2017-08-04 09:41:55 -04:00
Miek Gieben
2c0fc3182c middleware/kubernetes: cleanup (#818)
Drop the interfaceAddr interfaces and just use a function. Cleanup
all fallout from that. Remove the use of global variables and cleanup
the tests a bit.
2017-08-03 23:14:11 -07:00
Sandeep Rajan
8ad8c75ab4 Middleware/k8s: Add unit tests for Pods (#815)
* Added Pod testing

* Cleanup

* fixed formatting
2017-08-03 12:16:50 -07:00
Miek Gieben
cd1f2f1bbf mw/kubernete: small cleanup (#810)
* mw/kubernete: small cleanup

Small cleanup, avoid pointer to []msg.Services and just returns the
msg.Service.

* Actually compile

* testss
2017-08-03 09:03:53 -07:00
Sandeep Rajan
2410f5b3f4 Add TXT coverage (#807) 2017-08-02 12:42:15 -04:00
Miek Gieben
9b805988f4 README.md: clean TLS cert language (#797)
Cleanup various READMEs to use the same naming scheme for certs, keys,
and cacerts.

Fixes #762
2017-07-29 04:03:55 -07:00
Chris O'Haver
58006cf847 middleware/kubernetes: fix aaaa response (#780)
* fix aaaa response

* unit tests
2017-07-20 08:19:29 -04:00
Chris O'Haver
8495e48297 k8s/autopath: Add CNAMES (#771)
* Add unit tests & cnames

* more progress

* fix

* next mw dependent unit tests

* add tests for OnNXDOMAIN

* Add AAAA and ndots unit tests; fix request.NewWithQuestion

* Correct default value in README

* add CNAMEs to readme

* review

* fix autopath examples

* fix and test CNAME response order
2017-07-11 18:05:32 -04:00
Chris O'Haver
21b0038b54 remove unused code (#774) 2017-07-07 12:44:30 -07:00
Mia Boulay
ade7603021 middleware/backend: add Records() to ServiceBackend interface (#770) 2017-07-01 15:19:57 -07:00
Chris O'Haver
25d116d4ae middleware/kubernetes: Rewrite/expand readme (#764)
* rewrite readme

* remove breaks

* missed a break

* nits

* show options as optional
* add note to pods insecure
* add minimal configuration example.
* add a note about replacing kube-dns in the summary
* move deployment section into summary.

* Update README.md

* replace options sections with bullets

and indent all sub sections to match bullet indentation.
not sure if this will render in github properly - it doesn't in the in-line editor preview.

* fix indentation

Contrary to various on-line guides and editors, github now requires 2 spaces to indent paragraphs with bulleted sections above (not just 1).

* Update README.md

* Update README.md

* Update README.md

* fix label syntax

It's just a single EXPRESSION.  The EXPRESSION itself has its own kubernetes label expression format.

* Update README.md

* Update README.md
2017-07-01 00:20:21 -07:00
Chris O'Haver
edf71fb168 middleware/kubernetes: Server side path lookups (#750)
* initial commit

* add config options

* add readme

* rewording

* revert unlreated change

* normalize host domain path

* add ndots opt, allow > 1 host domains, pull host domains from resolv.conf

* implementing review feedback

* update readme

* use dns lib, config format, defaults

* Correct autopath example.
2017-06-28 18:44:30 -04:00
Chris O'Haver
6f9a9eb8cd dont load default vals from env (#751) 2017-06-23 18:02:45 -04:00
Chris O'Haver
7219bff11f compress empty implementations to single line (#740) 2017-06-16 09:11:53 -07: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
2ec96e0bb5 remove unused funcs (#724) 2017-06-09 08:00:09 +01:00
Chris O'Haver
18bc52b5e0 add more coverage (#702) 2017-06-03 08:27:24 +01:00
Chris O'Haver
ecae087201 unexpose items per lint (#701) 2017-06-02 23:54:33 -04:00
Chris O'Haver
d684dedfd3 unexpose InterfaceAddrser (#693) 2017-06-02 07:25:33 +01:00
Chris O'Haver
381ec9d7f8 fix typo (#692) 2017-06-01 22:44:10 -04: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
Manuel Alejandro de Brito Fontes
7c8d1b0234 Check that all the controllers are synced agains api server (#671) 2017-05-25 20:08:44 +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
8fc7ec776d Update the various Kubernetes middleware README files. (#630) 2017-04-19 22:42:45 +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
d1bb4ea130 Don't error log NXDOMAIN (#572)
In both etcd and k8s don't error log NXDOMAIN as this log spams the logs
for no good reason.

Fixes #568

Better long term solution is log rate limiting for both *log* and
*error*.
2017-03-06 11:43:23 +00:00
Miek Gieben
12678ac5e2 middleware/kubernetes: doc cleanup (#571)
Set of small cleanups.
2017-03-06 11:42:59 +00:00
John Belamaric
838427c95d Remove deployment helpers that are now in coredns/deployment/kubernetes (#554) 2017-02-22 21:44:20 +00:00
Miek Gieben
bf82f007fa Fix test (#549) 2017-02-22 09:23:41 +00:00
Miek Gieben
c5224b1048 Golint (#548)
* linter fixes

* Golint and format code

* fmt
2017-02-22 07:25:58 +00:00