aboutsummaryrefslogtreecommitdiff
path: root/middleware/kubernetes (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-08-23mw/kubernetes: revert if-else for health (#970)Gravatar Miek Gieben 1-51/+53
Do the return early and dedent the rest of the function.
2017-08-23Parse fix (#974)Gravatar Miek Gieben 2-0/+71
* 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-23mw/kubernetes: remove kPod and kServices (#969)Gravatar Miek Gieben 6-152/+109
Based up on: #939, but redone in a new PR with some cherry-picked commits: aacb91ef0b927683b21d6ee39dbddbd001334854 5dc34247b7d0136d9fe035f6b10d6b3e14ee7f2c 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-22mw/kubernetes: don't export Pod-mode constants. (#959)Gravatar Miek Gieben 4-42/+43
* mw/kubernetes: don't export Pod-mode constants. * merged
2017-08-22mw/kubernetes: resync to opts (#957)Gravatar Miek Gieben 5-63/+52
* 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-22mw/kubernetes: Rewrite parseRequest and Readability improvements (#939)Gravatar Miek Gieben 7-151/+175
* 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-22mw/*: updates docs about upstream (#968)Gravatar Miek Gieben 1-2/+2
Upstream allows file structured like /etc/resolv.conf. Update docs. Fixes #709
2017-08-22core: hide registerHandler (#964)Gravatar Miek Gieben 1-3/+0
* 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-19Dns.join (#944)Gravatar Miek Gieben 2-6/+5
* Add dnsutil.Join * Create dnsutil.Join Create Join helper function and move bits in the code over.
2017-08-19backend.Records make it take request.Request (#943)Gravatar Miek Gieben 1-8/+3
This is more general and aligns well with the other methods. Also allows the kubernetes middleware to use it. Fixes #940
2017-08-19mw/kubernetes: remove zone from parseRequest (#938)Gravatar Miek Gieben 3-10/+12
* 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-18mw/federation: add federation back as separate mw for k8s (#929)Gravatar Miek Gieben 12-102/+167
* 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-17mw/kubernetes: add reverse test case (#932)Gravatar Miek Gieben 1-3/+7
Add a non-arpa testcase to the reverse test.
2017-08-16tests: add SortAndCheck helper (#926)Gravatar Miek Gieben 2-38/+2
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-16mw/kubernetes: add reverse_test.go (#922)Gravatar Miek Gieben 4-19/+150
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-16Reverse in k8s (#923)Gravatar Miek Gieben 2-1/+38
* 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-14Make CoreDNS build on Go 1.7 (#919)Gravatar insomniac 1-1/+1
2017-08-14mw/kubernetes: remove federation and cidr (#916)Gravatar Miek Gieben 13-645/+152
* 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-11Add Autopath section to k8s readme (#898)Gravatar Chris O'Haver 1-0/+9
The primary driver for autopath was kubernetes. It addresses a specific need in kubernetes, so it deserves a mention in the K8s README, with an example.
2017-08-11mw/k8s: cleanups (#893)Gravatar Miek Gieben 4-26/+12
* mw/k8s: cleanups Remove some constants that aren't used any more. Make PrimaryZone private because it doesn't need to be exported. Remove test that did not cover corner case as expressed in setup.go * cleanup this as well
2017-08-11README Typos (#897)Gravatar Chris O'Haver 1-3/+3
Found a few typos, spelling, and grammar errors.
2017-08-11Fix some typos in README (#896)Gravatar Chris O'Haver 1-2/+2
remove extraneous "]"s from the syntax def...
2017-08-11Use server block defaults (#894)Gravatar Miek Gieben 3-138/+91
* mw/k8s: Test Federation parsing The test case was there, but there was nothing testing it?!?!?! Add it and split it out of the main setup test which is too long already. Also allow kubernetes a not have a ZONE, just default to the serverblock in that case. Remove test that was blocking that. Cleanup up the readme more. * rewrite README
2017-08-11mw/k8s: use request.Request in parseRequestGravatar Miek Gieben 5-19/+31
2017-08-11mw/k8s: remove k.defaultNsMsg() (#892)Gravatar Miek Gieben 2-16/+3
Remove k.defaultNSMsg() it is just one line of getting the service and it is another method that needlessly uses recordRequest.
2017-08-10Support multiple k8s api servers specification and load balance among api ↵Gravatar Yong Tang 4-4/+148
servers (#820) * Support multiple k8s api servers specification and load balance among api servers This fix adds supports for multiple k8s api servers specification, load balance among api servers. When two or more api servers are specified in kubernetes block (endpoint ...), a proxy is created locally (with randomly generately port). The coredns will points to the generated proxy so that load balancing could be achieved. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Setup initial healthcheck at the beginning Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update README.md for kubernetes middleware and remove whitespaces. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Use middleware/pkg/healthcheck in middleware/kubernetes for api proxy Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-10mw/k8s: remove dependence on global var (#888)Gravatar Miek Gieben 3-89/+48
* mw/k8s: remove dependence on global var Remove the global coreDNSRecord that was used. Remove tests the referenced that var. Cleanup the rest. * Rename function as well * fixes
2017-08-10kw/middleware: compress the README (#889)Gravatar Miek Gieben 1-114/+33
Remove the examples, save one in the syntax section. The example section covers all. This brings the kubernetes README inline with other READMEs.
2017-08-10Kubernetes cleanup6 (#887)Gravatar Miek Gieben 3-27/+8
* mw/kubernetes: handle dns.TypeNS better. * mw/kubernetes: cleanup typeNS replies a bit.
2017-08-10core: replace GetMiddleware (#885)Gravatar Miek Gieben 1-0/+3
* core: replace GetMiddleware See the discussion in #881. GetMiddleware would add a `nil` middleware to the callstack thereby breaking functionality. This PR drops it in favor of RegisterHandler which is a completely standalone registry for middleware that want to let it self know to other middleware. Currenly *autopath* uses this to call *kubernetes*'s AutoPath method for dynamic autopathing. * Drop GetMiddleware * Register metrics * drop the panic
2017-08-10mw/kubernetes: remove subzones (#878)Gravatar Miek Gieben 3-85/+7
Only use was in k8s middleware; no tests other than subzone_test.go existed; not exercised: remove.
2017-08-10middleware/authpath: Fix return from k8s mw (#871)Gravatar Miek Gieben 3-12/+38
* 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-10mw/kubernetes: fix parseTests (#875)Gravatar Miek Gieben 1-111/+47
* 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-10WIP: Parserequest2 cutback (#868)Gravatar Miek Gieben 8-324/+313
* 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-09middleware/kubernetes: put reverse function in own file (#863)Gravatar Miek Gieben 4-52/+66
Move reverse function and (some) test code to reverse*.go
2017-08-09mw/kubernetes: restore handler to pre-autopath state (#861)Gravatar Miek Gieben 1-34/+33
Pull in the contents of routeRequest as it is only called once.
2017-08-09mw/authpath: hook in kubernetees (#860)Gravatar Miek Gieben 2-9/+29
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-09WIP: autopath as middleware (#859)Gravatar Miek Gieben 10-626/+24
autopath as middleware
2017-08-08mw/kubernetes: warn about deprecating cidr (#858)Gravatar Miek Gieben 2-70/+66
Add log statement pointing to replacement. remove cidr from README and use replacement syntax. Fixes #851
2017-08-07mw/kubernetes: autopath refactors (#850)Gravatar Miek Gieben 7-210/+226
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-07middleware/kubernetes: autopath in sub package (#848)Gravatar Miek Gieben 7-95/+103
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-06all: gometalinter (#843)Gravatar Miek Gieben 6-79/+52
* 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-05middleware/kubernetes: fixes (#837)Gravatar Miek Gieben 2-48/+48
dedent code, use shorter names. use strings.EqualFold instead ToLower to avoid create garbage.
2017-08-04not used anymore (#832)Gravatar Miek Gieben 1-10/+0
2017-08-04golint cleanup (#828)Gravatar Yong Tang 2-1/+3
Clean up some golint related issues. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-04Misspell correction (#826)Gravatar Yong Tang 2-2/+2
Did a `misspell . | grep -v ^vendor` and fixed several typos. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-04middleware/kubernetes: define consts (#824)Gravatar Miek Gieben 3-17/+22
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-04Kubernetes srv (#823)Gravatar Markus Sommer 2-22/+29
* 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-03middleware/kubernetes: cleanup (#818)Gravatar Miek Gieben 8-53/+25
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-03Middleware/k8s: Add unit tests for Pods (#815)Gravatar Sandeep Rajan 1-2/+76
* Added Pod testing * Cleanup * fixed formatting