aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/handler_test.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-03-07add client labels to k8s plugin metadata (#6475)Gravatar miles-to-go 1-1/+7
Signed-off-by: Nolan Miles <nolanpmiles@gmail.com>
2023-06-19plugin/kubernetes: filter ExternalName services from matching double ↵Gravatar Dan Wilson 1-0/+8
subdomain wildcard (#6162) remove double subdomain reference from review feedback not subdoman Signed-off-by: emaildanwilson <dan@controlplane.com> Co-authored-by: emaildanwilson <dan@controlplane.com>
2022-12-13plugin/kubernetes: error NXDOMAIN for TXT lookups (#5737)Gravatar LAMRobinson 1-0/+16
plugin/kubernetes: fix NXDOMAIN/NOERROR responses for TXT queries Signed-off-by: Laurence Robinson <laurence_robinson@live.co.uk> Co-authored-by: Laurence Robinson <laurence.robinson@deshaw.com>
2022-11-04dont match external services when endpoint is specified (#5734)Gravatar Chris O'Haver 1-8/+16
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-07-10add golangci-lint linter (#5499)Gravatar Ondřej Benkovský 1-1/+0
2022-07-06plugin/k8s_external: Add support for PTR requests (#5435)Gravatar Chris O'Haver 1-6/+7
* Exclude External IP addresses from being added to the existing kubernetes' plugin IP->Service index * Add support for PTR requests on External IPs of Services to the k8s_external plugin Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-03-07plugin/k8s_external: implement zone transfers (#4977)Gravatar Chris O'Haver 1-1/+1
Implement transfer for k8s_external. Notifies not supported. Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-02-22plugin/etcd+kubernetes: Persist truncated state to client if CNAME lookup ↵Gravatar Chris O'Haver 1-81/+155
response is truncated (#4715) Persist the TC bit to client response for truncated CNAME lookups. Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2022-02-14auto go fmtGravatar coredns[bot] 1-2/+2
Signed-off-by: coredns[bot] <bot@bot.coredns.io>
2022-02-09remove wildcard query functionality (#5019)Gravatar Chris O'Haver 1-55/+2
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-07-29kubernetes: Improve namespace usage (#4767)Gravatar Mat Lowery 1-6/+4
* Use GetByKey instead of List in GetNamespaceByName. * Add ToNamespace to reduce memory for namespace cache. Signed-off-by: Mat Lowery <mlowery@ebay.com>
2021-06-14Add NS+hosts records to xfr response. Add coredns service to test data. (#4696)Gravatar Chris O'Haver 1-0/+26
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-04plugin/kubernetes: fix SOA response for non-apex queries (#4592)Gravatar Chris O'Haver 1-0/+7
* fix SOA response for non-apex queries Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * handle mixed case Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * do full string compare Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-12-21plugin/kubernetes: Add support for dual stack ClusterIP Services (#4339)Gravatar Chris O'Haver 1-24/+58
* support dual stack clusterIPs Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * stickler Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * fix ClusterIPs make Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-10-30plugin/kubernetes: Watch EndpointSlices (#4209)Gravatar Chris O'Haver 1-4/+8
* initial commit Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * convert endpointslices to object.endpoints Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add opt hard coded for now Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * check that server supports endpointslice Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * fix import grouping Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * dont use endpoint slice in 1.17 or 1.18 Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * bump kind/k8s in circle ci to latest Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * drop k8s to latest supported by kind Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * use endpointslice name as endoint Name; index by Service name Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * use index key comparison in nsAddrs() Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add Index to object.Endpoint fixtures; fix direct endpoint name compares Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add slice dup check and test Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * todo Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add ep-slice skew dup test for reverse Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * nsaddrs: de-dup ep-slice skew dups; add test Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * remove todo Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * address various feedback Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * consolidate endpoint/slice informer code Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * fix endpoint informer consolidation; use clearer func name Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * log info; use major/minor fields Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * fix nsAddr and unit test Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add latency tracking for endpointslices Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * endpointslice latency unit test & fix Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * code shuffling Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * rename endpointslices in tests Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * remove de-dup from nsAddrs and test Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * remove de-dup from findServices / test Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-09-24Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142)Gravatar Yong Tang 1-2/+1
* Implement notifies for transfer plugin (#3972) * Fix notifies in transfer plugin Signed-off-by: Miek Gieben <miek@miek.nl> * Make it compile Signed-off-by: Miek Gieben <miek@miek.nl> * Port more plugins Signed-off-by: Miek Gieben <miek@miek.nl> * golint Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl> * Fix notifies in transfer plugin Signed-off-by: Miek Gieben <miek@miek.nl> * Make it compile Signed-off-by: Miek Gieben <miek@miek.nl> * Port more plugins Signed-off-by: Miek Gieben <miek@miek.nl> * golint Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl> * really fix test Signed-off-by: Miek Gieben <miek@miek.nl> * Implement ixfr fallback and unify file and auto for transfering Signed-off-by: Miek Gieben <miek@miek.nl> * Add transfer tests copied and modified from #3452 Signed-off-by: Miek Gieben <miek@miek.nl> * Test correct selection of plugin Signed-off-by: Miek Gieben <miek@miek.nl> * add upstream back in Signed-off-by: Miek Gieben <miek@miek.nl> * Implement ixfr fallback and unify file and auto for transfering Signed-off-by: Miek Gieben <miek@miek.nl> * fix test Signed-off-by: Miek Gieben <miek@miek.nl> * properly merge Signed-off-by: Miek Gieben <miek@miek.nl> * Remove plugin/kubernetes/setup_transfer_test.go Signed-off-by: Yong Tang <yong.tang.github@outlook.com> Co-authored-by: Miek Gieben <miek@miek.nl>
2020-07-08Revert "Implement notifies for transfer plugin (#3972)" (#3995)Gravatar Yong Tang 1-1/+2
This reverts commit 68f1dd5ddf0451cc3a1b24a72c2965b8d896ffba. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2020-07-07Implement notifies for transfer plugin (#3972)Gravatar Miek Gieben 1-2/+1
* Fix notifies in transfer plugin Signed-off-by: Miek Gieben <miek@miek.nl> * Make it compile Signed-off-by: Miek Gieben <miek@miek.nl> * Port more plugins Signed-off-by: Miek Gieben <miek@miek.nl> * golint Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl> * Fix notifies in transfer plugin Signed-off-by: Miek Gieben <miek@miek.nl> * Make it compile Signed-off-by: Miek Gieben <miek@miek.nl> * Port more plugins Signed-off-by: Miek Gieben <miek@miek.nl> * golint Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl> * really fix test Signed-off-by: Miek Gieben <miek@miek.nl> * Implement ixfr fallback and unify file and auto for transfering Signed-off-by: Miek Gieben <miek@miek.nl> * Add transfer tests copied and modified from #3452 Signed-off-by: Miek Gieben <miek@miek.nl> * Test correct selection of plugin Signed-off-by: Miek Gieben <miek@miek.nl> * add upstream back in Signed-off-by: Miek Gieben <miek@miek.nl> * Implement ixfr fallback and unify file and auto for transfering Signed-off-by: Miek Gieben <miek@miek.nl> * fix test Signed-off-by: Miek Gieben <miek@miek.nl> * properly merge Signed-off-by: Miek Gieben <miek@miek.nl>
2020-03-30Update k8s.io/[api|apimachinery|client-go] to v0.18.0 (#3796)Gravatar Yong Tang 1-1/+1
* Update k8s.io/[api|apimachinery|client-go] to v0.18.0 This PR updates k8s.io/[api|apimachinery|client-go] to v0.18.0 This PR closes 3791 This PR closes 3792 This PR closes 3793 Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix test failures Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix failed tests Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Fix test failure Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-12-19Bump kubernetes plugin schema version (#3554)Gravatar Antonio Ojea 1-1/+1
The Kubernetes DNS specification schema version was updated to 1.1.0 in order to support IPv6 Signed-off-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>
2019-09-23cleanup: remove redundant return statement (#3297)Gravatar Guangming Wang 1-1/+1
Signed-off-by: Guangming Wang <guangming.wang@daocloud.io>
2019-08-12fix NXDOMAIN/NODATA fallthough case (#3118)Gravatar Chris O'Haver 1-0/+24
2019-08-09plugin/kubernetes: Don't do a zone transfer for NS requests (#3098)Gravatar Chris O'Haver 1-0/+8
* fix switch order * remove fallthough * add test * fix test * distingush nxdomain/nodata for at least first subdomain of zone * restore fallthough; reorder switch cases
2019-06-09Publish metadata from kubernetes plugin (#2829)Gravatar John Belamaric 1-2/+5
* Publish metadata from kubernetes plugin * stickler fix * Add a couple tests * Add metadata section to README * Update plugin/kubernetes/README.md Co-Authored-By: Chris O'Haver <cohaver@infoblox.com> * Address nit
2019-03-22Add `namespace_labels` configuration for kubernetes plugin (#2707)Gravatar Matt Greenfield 1-0/+57
2019-02-17cleanup by fmt and remove redundant type declarations (#2563)Gravatar Sandeep Rajan 1-2/+2
2019-02-11Remove grpc watch functionality (#2549)Gravatar Miek Gieben 1-4/+0
This was added, but didn't see any use. For a large, complex chunk of code we should have some users of it. Remove all watch functionally from plugins, servers and packages. Fixes: #2548 Signed-off-by: Miek Gieben <miek@miek.nl>
2019-01-19Stop importing testing in the main binary (#2479)Gravatar Miek Gieben 1-5/+12
* Stop importing testing in the main binary Stop importing "testing" into the main binary: * test/helpers.go imported it; remote that and change function signature * update all tests that use this Signed-off-by: Miek Gieben <miek@miek.nl> * Drop import testing from metrics plugin Signed-off-by: Miek Gieben <miek@miek.nl> * more fiddling Signed-off-by: Miek Gieben <miek@miek.nl>
2019-01-10fix soa min ttl in tests cases (#2451)Gravatar Chris O'Haver 1-12/+12
2019-01-10set minttl to ttl setting (#2446)Gravatar Chris O'Haver 1-12/+12
2018-12-08plugin/kubernetes: smaller map (#2383)Gravatar Miek Gieben 1-2/+2
* plugin/kubernetes: smaller map to continue with a theme: the map[string]bool can be reduced to map[string]struct{} to reduce a tiny amount of memory. Signed-off-by: Miek Gieben <miek@miek.nl> * fix tests Signed-off-by: Miek Gieben <miek@miek.nl>
2018-11-16Set SOA record TTL as min of TTL/MINIMUM (#2295)Gravatar stuart nelson 1-8/+8
* Set SOA record TTL as min of TTL/MINIMUM According to https://tools.ietf.org/html/rfc2308#section-3: The TTL of this record is set from the minimum of the MINIMUM field of the SOA record and the TTL of the SOA itself, and indicates how long a resolver may cache the negative answer. Set the TTL accordingly so as to not always negative cache SOA records for 300 seconds. * Inline min func * Update SOA record tests * Fix types
2018-10-22Unblock startup if kubernetes API is unavailable (#2126)Gravatar Kevin Nisbet 1-2/+51
2018-10-11Revert "use keys (#2167)" (#2188)Gravatar Miek Gieben 1-78/+91
This reverts commit 974ed086f25ad45a01947e276e2eb8aa73d007a3.
2018-10-10use keys (#2167)Gravatar Chris O'Haver 1-91/+78
2018-10-09plugin/kubernetes: allow trimming down of cached items. (#2128)Gravatar Miek Gieben 1-174/+110
* Convert to runtime.Object to smaller structs This adds conversion for all the objects we want to keep in the cache. It keeps the minimum for CoreDNS to function and throws away the rest. The conversion: api.Endpoints -> object.Endpoints api.Pod -> object.Pod api.Serivce -> object.Service We needed to copy some client-go stuff to insert a conversion function into NewIndexInformers. Some unrelated cleanups in the watch functionality as that needed to be touched because of the above translation of objects. Signed-off-by: Miek Gieben <miek@miek.nl> * Reduce test line-count Signed-off-by: Miek Gieben <miek@miek.nl> * ....and fix test Signed-off-by: Miek Gieben <miek@miek.nl> * Drop use of append Signed-off-by: Miek Gieben <miek@miek.nl> * cosmetic changes Signed-off-by: Miek Gieben <miek@miek.nl> * that was a typo Signed-off-by: Miek Gieben <miek@miek.nl> * re-introduce append here We can't really use len() here because we don't know the number before hand. Signed-off-by: Miek Gieben <miek@miek.nl> * comment in better place Signed-off-by: Miek Gieben <miek@miek.nl> * Make the timestamp a bool; thats where it is used for Signed-off-by: Miek Gieben <miek@miek.nl> * Set incoming object to nil Explicataliy discard the converted object; we did a deep copy it's not needed anymore. Signed-off-by: Miek Gieben <miek@miek.nl> * Per Chris's comment Signed-off-by: Miek Gieben <miek@miek.nl>
2018-08-27handle blank name and namespaces (#2042)Gravatar Chris O'Haver 1-0/+7
2018-08-27plugin/kubernetes: dont transfer unexposed namespaces (#2044)Gravatar Chris O'Haver 1-0/+16
dont transfer unexposed namespaces
2018-08-27plugin/kubernetes: Create records for portless services (#2052)Gravatar Chris O'Haver 1-0/+50
inject sentinels for portless services
2018-08-25fix kubernetes in-cluster CNAME lookup (#2040)Gravatar Bingshen Wang 1-0/+24
fix #2038 Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
2018-06-27Watch feature (#1527)Gravatar John Belamaric 1-0/+4
* Add part 1 watch functionality. (squashed) * add funcs for service/endpoint fqdns * add endpoints watch * document exposed funcs * only send subset deltas * locking for watch map * tests and docs * add pod watch * remove debugs prints * feedback part 1 * add error reporting to proto * inform clients of server stop+errors * add grpc options param * use proper context * Review feedback: * Removed client (will move to another repo) * Use new log functions * Change watchChan to be for string not []string * Rework how k8s plugin stores watch tracking info to simplify * Normalize the qname on watch request * Add blank line back * Revert another spurious change * Fix tests * Add stop channel. Fix tests. Better docs for plugin interface. * fmt.Printf -> log.Warningf * Move from dnsserver to plugin/pkg/watch * gofmt * remove dead client watches * sate linter * linter omg
2018-05-23ADD ignoreemptyservice option for kubernetes plugin (#1813)Gravatar darkweaver87 1-0/+62
* ADD: ignoreemptyservice option for kubernetes plugin * Modify documentation and rename option to add space * UPD: Add unit tests * UPD: gofmt * Add unit test for ignore emptyservice * gofmt * xfr tests failed * Rename emptyservice to empty_service
2018-05-21Enforcing gofmt -s on linter check (#1820)Gravatar Yong Tang 1-3/+2
This fix enforces gofmt -s on linter check in Makefile, and fixes `plugin/kubernetes/handler_test.go` and `plugin/tls/tls_test.go` with `gofmt -s`
2018-05-18add dup endpoint name test (#1811)Gravatar Chris O'Haver 1-6/+30
2018-04-22all: fix plugin import ordering (#1717)Gravatar Miek Gieben 1-2/+1
Got a bit messed up with stb lib "context" usage.
2018-04-20global: move to context (#1699)Gravatar Miek Gieben 1-1/+2
* global: move to context Move from golang.org/x/net/context to std lib's context. Change done with: for i in $(grep -l '/context' **/*.go); do sed -e 's|golang.org/x/net/context|context|' -i $i; echo $i; done for i in **/*.go; do goimports -w $i; done * drop from dns.pb.go as well
2018-04-18plugin/kubernetes: check for bare zone query (#1692)Gravatar Chris O'Haver 1-0/+14
* check for bare zone query * check for bare type query
2018-02-08support for zone transfer for kubernetes (#1259)Gravatar Brad Beam 1-0/+11
* plugin/kubernetes: axfr Hook up dynamic SOA serial by setting ResourceEventHandlerFuncs in dnsController. Add prototype of returns msg.Services via the Transfer function. Leave expanding this to RRs out of scope for a bit. * plugin/kubernetes: axfr Respond to AXFR queries * Fixing race condition * Fixing instantiation of dnstest writer * Updates from review
2018-01-05plugin/kubernetes: add explicit non-existing ns check (#1350)Gravatar Miek Gieben 1-0/+8
We already do the right thing here, but add a test none-the-less.
2018-01-03Update k8s client-go to v6.0.0 (#1340)Gravatar Yong Tang 1-1/+1
* Update k8s client-go to v6.0.0 This fix updates k8s client-go to v6.0.0 as CoreDNS is supported in 1.9 and v6.0.0 is the recommended version. There are quite some massive changes that need to be made: 1. k8s.io/client-go/pkg/api/v1 has been changed to k8s.io/api/v1 (repo changed from `client-go` to `api`) 2. kubernetes.Clientset adds one extra layer, so that `kubernetes.Clientset.Services()` and like has been changed to `kubernetes.Clientset.CoreV1().Services()` Also, we have to stick with specific commits of `k8s.io/apimachinery` and the newly introduced `k8s.io/api` because go dep still could not figure out the right version to fetch. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update vendor with `dep ensure --update` and `dep prune` Signed-off-by: Yong Tang <yong.tang.github@outlook.com>