Commit graph

239 commits

Author SHA1 Message Date
coredns[bot]
4c41c49a93 auto go fmt
Signed-off-by: coredns[bot] <bot@bot.coredns.io>
2021-08-02 10:29:33 +00:00
Mat Lowery
9d5b8cd13d
kubernetes: Improve namespace usage (#4767)
* Use GetByKey instead of List in GetNamespaceByName.
* Add ToNamespace to reduce memory for namespace cache.

Signed-off-by: Mat Lowery <mlowery@ebay.com>
2021-07-29 23:27:25 -04:00
Jeongwook Park
faa10f61af
Fix typo on kubernetes plugin (#4753)
- modifed -> modified

Signed-off-by: jeongwook-park <jeongwook.park@navercorp.com>
2021-07-14 14:29:41 -04:00
mfleader
38e409b4b6
Correct newdnsController's documented function signature (#4717)
Signed-off-by: mleader <mleader@redhat.com>
2021-06-24 15:18:08 -04:00
Chris O'Haver
a1aafbf405
Add NS+hosts records to xfr response. Add coredns service to test data. (#4696)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-06-14 16:39:40 +02:00
uesyn
4c0fdc3909
plugin/kubernetes: consistently choose EndpointSlices or Endpoints for unstable API (#4647)
* confirm endpointslices is served or not

Signed-off-by: uesyn <suemura@zlab.co.jp>

* Apply suggestions

Signed-off-by: uesyn <suemura@zlab.co.jp>
2021-05-27 08:48:52 -04:00
Miek Gieben
5f41d8eb1f
reverse zone: fix Normalize (#4621)
Make normalize return multiple "hosts" (= reverse zones) when a
non-octet boundary cidr is given.

Added pkg/cidr package that holds the cidr calculation routines; felt
they didn't really fit dnsutil.

This change means the IPNet return parameter isn't needed, the hosts are
all correct. The tests that tests this is also removed: TestSplitHostPortReverse
The fallout was that zoneAddr _also_ doesn't need the IPNet member, that
in turn make it visible that zoneAddr in address.go duplicated a bunch
of stuff from register.go; removed/refactored that too.

Created a plugin.OriginsFromArgsOrServerBlock to help plugins do the
right things, by consuming ZONE arguments; this now expands reverse
zones correctly. This is mostly mechanical.

Remove the reverse test in plugin/kubernetes which is a copy-paste from
a core test (which has since been fixed).

Remove MustNormalize as it has no plugin users.

This change is not backwards compatible to plugins that have a ZONE
argument that they parse in the setup util.

All in-tree plugins have been updated.

Signed-off-by: Miek Gieben <miek@miek.nl>
2021-05-17 13:19:54 -07:00
Chris O'Haver
5409379648
consider nil ready as ready (#4632)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-17 16:10:30 -04:00
Chris O'Haver
0a3375e76b
copy unready exclusion to v1beta1 func (#4616)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-10 13:29:56 -04:00
Chris O'Haver
24547447d0
plugin/kubernetes: Support both v1 and v1beta1 EndpointSlices (#4570)
* support v1 and v1beta1 endpointslice

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* update comments

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-10 09:57:23 -07:00
Chris O'Haver
d6d8a9974b
plugin/kubernetes: fix SOA response for non-apex queries (#4592)
* 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>
2021-05-04 11:05:08 +02:00
Chris O'Haver
e1931d48d1
collect endpoint node name from endopintslices (#4581)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-05-04 10:55:49 +02:00
Chris O'Haver
ef53f372ee
exclude unready endpoints from endpointslices (#4580)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-04-27 12:29:32 -04:00
Chris O'Haver
9f72db12e7
plugin/kubernetes: do endpoint/slice check in retry loop (#4492)
* do endpoint/slice check in retry loop

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-03-26 08:54:39 -04:00
Miek Gieben
74ef6e00f1
transfer: reply with refused (#4510)
* transfer: reply with refused

When the *transfer* plugin is not loaded and of the handlers will still
see the AXFR/IXFR request because it is not intercepted.

They need to reply with REFUSED in that case. Update file, auto and k8s
to do this. Add testcase in the file plugin.

Ideally *erratic* should be moved over as well, but maybe that's
*erratic*

This is a bug fix.

Signed-off-by: Miek Gieben <miek@miek.nl>

* import path

Signed-off-by: Miek Gieben <miek@miek.nl>
2021-03-09 12:17:34 -08:00
Miek Gieben
c2028e330f
plugin/kubernetes: don't return when ServerVersion return an error (#4490)
When err=nil try to determine the version of the k8s cluster and disable
endpoint slices. Don't return from connecting to the cluster.

In the future we should just default to true, and delete all this code.

Signed-off-by: Miek Gieben <miek@miek.nl>
2021-02-25 18:14:57 +01:00
Jun Chen
a5bc3891e8
make kubernetes plugin kubeconfig argument 'context' optional (#4451)
Signed-off-by: answer1991 <answer1991.chen@gmail.com>
2021-02-09 14:36:32 +01:00
Lars Ekman
6ff19342d3
Corrected detection of K8s minor version (#4430)
Fixes #4428

Signed-off-by: Lars Ekman <lars.g.ekman@est.tech>
2021-01-26 09:27:37 -05:00
Miek Gieben
38d4dacb88
Fix import ordering presubmit test (#4422)
Automatically submitted.
2021-01-24 17:28:49 +00:00
Guangwen Feng
876650d638
Fix golint issue caused by typo (#4365)
Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
2021-01-06 08:34:32 -05:00
Chris O'Haver
51c05679e6
plugin/kubernetes: Add support for dual stack ClusterIP Services (#4339)
* 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-12-21 02:30:24 -08:00
Jiang Biao
fc955fd166
[feat]:update the kubernets.go fix npe (#4338)
Signed-off-by: Biao Jiang <standup-jb@github.com>

Co-authored-by: biao.jiang@ximalaya.com <biao.jiang@ximalaya.com>
2020-12-16 12:31:34 +01:00
Chris O'Haver
9121e78496
plugin/kubernetes: Fix dns programming duration metric (#4255)
* get data reqd to record latency before calling toFuncs
* refactor out unnecessary toFunc wrappers
* remove latency metric unit tests per PR feedback

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-12-01 15:29:05 -05:00
coredns-auto-go-fmt[bot]
4b87be2a0e auto go fmt 2020-11-11 12:30:39 +00:00
Chris O'Haver
272ccb195d
plugin/kubernetes: Watch EndpointSlices (#4209)
* 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-10-30 08:14:30 -04:00
Miek Gieben
c2e4f2f1ab
docs: move Also See to See Also (#4245)
sed -i 's/Also See/See Also/' plugin/**/README.md

Some plugins did already use 'See Also', so it's all consistent now.

Fixes: #4196

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-10-28 10:56:35 -07:00
ZouYu
c58e4b09fc
Fix golint warnings (#4241)
Include:
1. plugin/forward/type.go:8:2: const typeUdp should be typeUDP
2. plugin/forward/type.go:9:2: const typeTcp should be typeTCP
3. plugin/forward/type.go:10:2: const typeTls should be typeTLS
4. plugin/kubernetes/metrics.go:24:2: var DnsProgrammingLatency should be DNSProgrammingLatency
5. plugin/kubernetes/metrics_test.go:124:102: func parameter clusterIp should be clusterIP

Signed-off-by: zouyu <zouy.fnst@cn.fujitsu.com>
2020-10-28 07:39:56 +01:00
Yong Tang
9798dd067f
Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142)
* 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-09-24 20:30:39 +02:00
Miek Gieben
b003d06003
For caddy v1 in our org (#4018)
* For caddy v1 in our org

This RP changes all imports for caddyserver/caddy to coredns/caddy. This
is the v1 code of caddy.

For the coredns/caddy repo the following changes have been made:

* anything not needed by us is deleted
* all `telemetry` stuff is deleted
* all its import paths are also changed to point to coredns/caddy
* the v1 branch has been moved to the master branch
* a v1.1.0 tag has been added to signal the latest release

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix imports

Signed-off-by: Miek Gieben <miek@miek.nl>

* Group coredns/caddy with out plugins

Signed-off-by: Miek Gieben <miek@miek.nl>

* remove this file

Signed-off-by: Miek Gieben <miek@miek.nl>

* Relax import ordering

github.com/coredns is now also a coredns dep, this makes
github.com/coredns/caddy fit more natural in the list.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix final import

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-09-24 18:14:41 +02:00
Miek Gieben
24e668ecf0
goreport card fixes (#4139)
This fixes some inefassign as report by Go report card:
https://goreportcard.com/report/github.com/coredns/coredns

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-09-22 09:22:00 +02:00
Hu Shuai
e233f59ee8
Fix some typos in comments. (#4100)
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2020-09-01 09:10:45 +02:00
Zou Nengren
4166dcc2fe
using promauto package to ensure all created metrics are properly registered (#4025)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-07-25 08:06:28 -07:00
Yong Tang
614d08cba2
Revert "Implement notifies for transfer plugin (#3972)" (#3995)
This reverts commit 68f1dd5ddf.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2020-07-08 09:00:26 -07:00
Miek Gieben
68f1dd5ddf
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>
2020-07-07 12:38:07 -07:00
Zou Nengren
8647592786
format and add newline (#3969)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-06-24 07:48:39 -07:00
Chris O'Haver
d902e85919
plugin/kubernetes: fix tombstone unwrapping (#3924)
* fix tombstone unwrapping

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-06-15 10:15:41 -04:00
Yang Bo
4734c0db45
weight for SRV records should be at least 1 (#3931)
Automatically submitted.
2020-06-12 06:01:28 +00:00
Michael Kashin
2e3ef77731
k8s_external can now resolve CNAME returned by AWS ELB/NLB (#3916)
Automatically submitted.
2020-05-29 17:04:23 +00:00
Chris O'Haver
a3aeb3d503
plugin/kubernetes: handle tombstones in default processor (#3890)
* handle deletion tombstones in default processor

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* fix terminating pod exclusion

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-05-15 09:47:29 -07:00
Chris O'Haver
bb7ee5010e
plugin/kubernetes: Handle endpoint tombstones (#3887)
* check for nil

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* handle tombstone

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* move casting to caller. add comments.

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* more sanding

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* more scrubbing

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* move object unwraping to switch cases

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* oops remove debug

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* remove cruft

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-05-14 12:39:40 -07:00
Chris O'Haver
5897a7c03d
plugin/kubernetes: Mention remote IP requirement for autopath and metadata in README (#3876)
* mention remote IP requirement for autopath and metadata

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* remove whitespace

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-05-06 09:07:14 -07:00
Chris O'Haver
7c7772b735
always add client metadata (#3874)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-05-05 11:34:24 -07:00
Chris O'Haver
a5e286ac4e
plugin/kubernetes: Don't panic with metadata enabled and pods mode not verified (#3869)
* prevent panic in podWithIP

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* add unit test, correct existing unit test

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>

* unit tests make more sense this way

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-05-04 10:17:26 +02:00
Zou Nengren
c639615615
remove ignored option at kubernetes plugin (#3737)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-04-14 09:03:18 -04:00
Ben Kochie
a29a594e5c
Update more metrics names (#3799)
The subsystem of a metric must be it's plugin name. "dns" is reserved
for the core. Use a const convention to avoid copy-paste mistakes in
naming.

Fix dns64 and acl plugin.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-03-31 20:03:18 +02:00
Yong Tang
ebbfffaf9d
Update k8s.io/[api|apimachinery|client-go] to v0.18.0 (#3796)
* 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>
2020-03-30 11:10:41 -07:00
Zou Nengren
8bbfa19223
remove federation (#3794)
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-03-30 09:08:20 -07:00
Miek Gieben
b8e96b61fc
Update README.md (#3721)
Signed-off-by: imba-tjd <imba-tjd@users.noreply.github.com>
2020-03-05 11:09:19 +01:00
Chris O'Haver
6ef105ced3
return all records with matching ip (#3687)
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2020-02-21 07:24:02 +01:00
Chris O'Haver
c9d567ab44
plugin/kubernetes: fix metadata (#3642)
Automatically submitted.
2020-01-31 19:35:22 +00:00