aboutsummaryrefslogtreecommitdiff
path: root/middleware/kubernetes/kubernetes.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-09-14Remove the word middleware (#1067)Gravatar Miek Gieben 1-457/+0
* Rename middleware to plugin first pass; mostly used 'sed', few spots where I manually changed text. This still builds a coredns binary. * fmt error * Rename AddMiddleware to AddPlugin * Readd AddMiddleware to remain backwards compat
2017-09-12Remove debug queries (#1058)Gravatar Miek Gieben 1-14/+9
* Remove debug from interface and methods * remove debug queries from etcd * remove debug queries from k8s - they were not used * And remove from mw/proxy-google as well * Remove debug query test
2017-08-26mw/kubernetes: add configurable TTL (#995)Gravatar Miek Gieben 1-3/+7
* 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-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-23mw/kubernetes: remove kPod and kServices (#969)Gravatar Miek Gieben 1-139/+46
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 1-11/+11
* mw/kubernetes: don't export Pod-mode constants. * merged
2017-08-22mw/kubernetes: resync to opts (#957)Gravatar Miek Gieben 1-18/+8
* 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 1-35/+40
* 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-19Dns.join (#944)Gravatar Miek Gieben 1-2/+2
* 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 1-3/+3
* 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 1-64/+64
* 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-16mw/kubernetes: add reverse_test.go (#922)Gravatar Miek Gieben 1-2/+0
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-14mw/kubernetes: remove federation and cidr (#916)Gravatar Miek Gieben 1-38/+9
* 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-11mw/k8s: cleanups (#893)Gravatar Miek Gieben 1-6/+6
* 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-11mw/k8s: use request.Request in parseRequestGravatar Miek Gieben 1-1/+1
2017-08-11mw/k8s: remove k.defaultNsMsg() (#892)Gravatar Miek Gieben 1-2/+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 1-3/+60
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 1-1/+1
* 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-10Kubernetes cleanup6 (#887)Gravatar Miek Gieben 1-13/+7
* mw/kubernetes: handle dns.TypeNS better. * mw/kubernetes: cleanup typeNS replies a bit.
2017-08-10middleware/authpath: Fix return from k8s mw (#871)Gravatar Miek Gieben 1-0/+1
* 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-10WIP: Parserequest2 cutback (#868)Gravatar Miek Gieben 1-131/+40
* 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 1-23/+0
Move reverse function and (some) test code to reverse*.go
2017-08-09WIP: autopath as middleware (#859)Gravatar Miek Gieben 1-18/+1
autopath as middleware
2017-08-07mw/kubernetes: autopath refactors (#850)Gravatar Miek Gieben 1-8/+0
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 1-12/+5
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 1-14/+6
* 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 1-41/+41
dedent code, use shorter names. use strings.EqualFold instead ToLower to avoid create garbage.
2017-08-04golint cleanup (#828)Gravatar Yong Tang 1-0/+3
Clean up some golint related issues. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-08-04middleware/kubernetes: define consts (#824)Gravatar Miek Gieben 1-12/+17
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 1-21/+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 1-9/+6
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-03mw/kubernete: small cleanup (#810)Gravatar Miek Gieben 1-20/+24
* mw/kubernete: small cleanup Small cleanup, avoid pointer to []msg.Services and just returns the msg.Service. * Actually compile * testss
2017-07-20middleware/kubernetes: fix aaaa response (#780)Gravatar Chris O'Haver 1-6/+7
* fix aaaa response * unit tests
2017-07-11k8s/autopath: Add CNAMES (#771)Gravatar Chris O'Haver 1-5/+4
* 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-01middleware/backend: add Records() to ServiceBackend interface (#770)Gravatar Mia Boulay 1-4/+9
2017-06-28middleware/kubernetes: Server side path lookups (#750)Gravatar Chris O'Haver 1-19/+52
* 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-23dont load default vals from env (#751)Gravatar Chris O'Haver 1-3/+1
2017-06-14cleanup: go vet and golint run (#736)Gravatar Miek Gieben 1-2/+2
* 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-14handle clusterIP endpoint queries (#730)Gravatar Chris O'Haver 1-32/+38
2017-06-14middleware/kubernetes: Implement current federation beta (#723)Gravatar Chris O'Haver 1-11/+66
* 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-02unexpose InterfaceAddrser (#693)Gravatar Chris O'Haver 1-1/+1
2017-05-30Add k8s external service CNAMEs (#677)Gravatar Chris O'Haver 1-4/+31
* 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-25Some golint cleanup (#674)Gravatar Yong Tang 1-3/+2
This commit fixes some golint issues in `core/dnsserver` and `middleware/kubernetes`. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-05-22Handle K8s middleware NS record (#662)Gravatar Chris O'Haver 1-65/+76
* 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-04-30Remove annoying INFO from k8s middleware (#655)Gravatar John Belamaric 1-3/+1
2017-04-19Add fallthrough support for Kubernetes (#626)Gravatar John Belamaric 1-0/+1
* 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-03-06middleware/kubernetes: doc cleanup (#571)Gravatar Miek Gieben 1-3/+1
Set of small cleanups.
2017-02-22Golint (#548)Gravatar Miek Gieben 1-1/+1
* linter fixes * Golint and format code * fmt
2017-02-22Fix import path `github.com/miekg/coredns` -> `github.com/coredns/coredns` ↵Gravatar Yong Tang 1-6/+6
(#547) This fix fixes import path from `github.com/miekg/coredns` -> `github.com/coredns/coredns`