aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/setup.go (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-12-13Drop obsolete client-go auth plugins (#5806)Gravatar Stephen Kitt 1-3/+1
* Drop obsolete client-go auth plugins The OpenStack plugin is no longer available, even in version 0.24.4 of client-go; see https://github.com/kubernetes/client-go/blob/v0.24.4/plugin/pkg/client/auth/openstack/openstack_stub.go It is replaced by the client-keystone-auth credential plugin. The plugin has been entirely removed in client-go 0.26.0, which breaks the build when any other dependency pulls in client-go 0.26.0 or later. The GCP plugin is deprecated in K8s 1.22+ and unavailable in 1.26+ (although it is still stubbed in client-go 0.26.0). Is it replaced by the gke-gcloud-auth-plugin credential plugin. Signed-off-by: Stephen Kitt <skitt@redhat.com> * Update plugin/kubernetes/setup.go Signed-off-by: Stephen Kitt <skitt@redhat.com> Co-authored-by: Chris O'Haver <cohaver@infoblox.com>
2022-07-10add golangci-lint linter (#5499)Gravatar Ondřej Benkovský 1-1/+0
2022-06-26plugin/kubernetes : make kubernetes client log in CoreDNS format (#5461)Gravatar Ondřej Benkovský 1-2/+2
Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
2022-02-09Revert "add wildcard warnings (#5030)" (#5167)Gravatar Chris O'Haver 1-21/+0
This reverts commit 744468ea78e278bb59c1e50673ff5028ebea539c.
2021-12-09add wildcard warnings (#5030)Gravatar Chris O'Haver 1-0/+21
Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-09-22plugin/kubernetes: fix reload panic (#4881)Gravatar Chris O'Haver 1-1/+1
* fix reload panic Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * add comment Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * o import ordering Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-08-03plugins/kubernetes: Switch to klog/v2 (#4778)Gravatar Manuel Rüger 1-1/+2
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2021-05-17reverse zone: fix Normalize (#4621)Gravatar Miek Gieben 1-13/+1
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-03-26plugin/kubernetes: do endpoint/slice check in retry loop (#4492)Gravatar Chris O'Haver 1-29/+7
* do endpoint/slice check in retry loop Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
2021-02-09make kubernetes plugin kubeconfig argument 'context' optional (#4451)Gravatar Jun Chen 1-7/+10
Signed-off-by: answer1991 <answer1991.chen@gmail.com>
2020-11-11auto go fmtGravatar coredns-auto-go-fmt[bot] 1-1/+1
2020-10-30plugin/kubernetes: Watch EndpointSlices (#4209)Gravatar Chris O'Haver 1-0/+1
* 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-10/+0
* 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-24For caddy v1 in our org (#4018)Gravatar Miek Gieben 1-1/+1
* 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-07-25using promauto package to ensure all created metrics are properly registered ↵Gravatar Zou Nengren 1-6/+0
(#4025) Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-07-08Revert "Implement notifies for transfer plugin (#3972)" (#3995)Gravatar Yong Tang 1-0/+10
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-10/+0
* 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-04-14remove ignored option at kubernetes plugin (#3737)Gravatar Zou Nengren 1-5/+0
Signed-off-by: zounengren <zounengren@cmss.chinamobile.com>
2020-03-31Update more metrics names (#3799)Gravatar Ben Kochie 1-4/+6
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-30Update k8s.io/[api|apimachinery|client-go] to v0.18.0 (#3796)Gravatar Yong Tang 1-1/+2
* 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-01-30presubmit: check import path ordering (#3636)Gravatar Miek Gieben 1-11/+4
Add a test for this as well as it's annoying to point out in every code review. Fix all the import paths that are flagged by this new test. Fixes: #3634 Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-04Measure and expose DNS programming latency from Kubernetes plugin. (#3171)Gravatar janluk 1-0/+6
For now metric is measure only for headless services. Informer has been slighlty refactored, so the code can measure latency without storing extra fields on Endpoint struct. Signed-off-by: Janek Łukaszewicz <janluk@google.com> Suggestions from code review Co-Authored-By: Chris O'Haver <cohaver@infoblox.com>
2019-09-20all: simply registering plugins (#3287)Gravatar Miek Gieben 1-6/+1
Abstract the caddy call and make it simpler. See #3261 for some part of the discussion. Go from: ~~~ go func init() { caddy.RegisterPlugin("any", caddy.Plugin{ ServerType: "dns", Action: setup, }) } ~~~ To: ~~~ go func init() { plugin.Register("any", setup) } ~~~ This requires some external documents in coredns.io to be updated as well; the old way still works, so it's backwards compatible. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-05plugin/kubernetes: Handle multiple local IPs and bind (#3208)Gravatar Chris O'Haver 1-1/+6
* use all local IPs * mult/bind ips * gofmt + boundIPs fix * fix no matching endpoint case * don't duplicate NS records in answer * fix answer dedup * fix comment * add multi local ip test case
2019-08-21typo fixes (#3169)Gravatar Chris O'Haver 1-1/+1
* spelling fixes * its/it's
2019-08-01Fixes races in test and klog (#3079)Gravatar Miek Gieben 1-3/+3
Various fixes to make things less flaky: * kubernetes: put klog.SetOutput in the setup function, not in the init function to see if that helps * file: make z.Expired a boolean instead of a pointer to a boolean * test: fix TestSecondaryZoneTransfer test, which wasn't actually testing in the right way. It's more right now, but may still be racy (race introduced because a file's lazy loading of zones) Signed-off-by: Miek Gieben <miek@miek.nl>
2019-07-30plugin/kubernetes: remove some of the klog setup (#3054)Gravatar Miek Gieben 1-13/+1
I don't believe this is actually needed (anymore). The: os.Stderr = os.Stdout is a crazy hack that def. needs to go. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-07-03ISSUE-2911 (#2923)Gravatar Anshul Sharma 1-13/+1
- Remove resyncperiod from Kubernetes plugin
2019-07-03Update Caddy to 1.0.1, and update import path (#2961)Gravatar Yong Tang 1-1/+1
* Update Caddy to 1.0.1, and update import path This fix updates caddy to 1.0.1 and also updates the import path to github.com/caddyserver/caddy This fix fixes 2959 Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Also update plugin.cfg Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update and bump zplugin.go Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-07-02plugins: set upstream unconditionally (#2956)Gravatar Miek Gieben 1-1/+3
`upstream` is not needed as a setting; just set if unconditionally and remove all documentation and tests for it. At some point we want remove the hanlding for `upstream` as well and error out on seeing it. Signed-off-by: Miek Gieben <miek@miek.nl>
2019-04-02plugin/kubernetes: Disable resync by default (#2752)Gravatar John Belamaric 1-1/+1
* Disable resync by default * Document default resync
2019-04-01Bump the resync period to five hours (#2748)Gravatar John Belamaric 1-1/+1
2019-03-22Add `namespace_labels` configuration for kubernetes plugin (#2707)Gravatar Matt Greenfield 1-0/+16
2019-03-11Remove proxy from kubernetes file (#2668)Gravatar Yong Tang 1-6/+0
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-02-07Set klog's logtostderr flag (#2529)Gravatar Guy Templeton 1-2/+8
* Parse as well as setlogtostderr flag * Enforce setting of logtostderr for klog * Clearup comment on klog
2019-01-13Deprecate multiple endpoints for out-of-cluster k8s api (#2454)Gravatar Yong Tang 1-7/+3
This fix deprecates endpoints for out-of-cluster k8s api, The Corefile still takes multiple endpoints though only the first one is used. A warning is shown if there are multiple endpoints. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-01-13Default to upstream to self (#2436)Gravatar Miek Gieben 1-6/+2
* Default to upstream to self This is a backwards incompatible change. This is a massive (cleanup) PR where we default to resolving external names by the coredns process itself, instead of directly forwarding them to some upstream. This ignores any arguments `upstream` may have had and makes it depend on proxy/forward configuration in the Corefile. This allows resolved upstream names to be cached and we have better healthchecking of the upstreams. It also means there is only one way to resolve names, by either using the proxy or forward plugin. The proxy/forward lookup.go functions have been removed. This also lessen the dependency on proxy, meaning deprecating proxy will become easier. Some tests have been removed as well, or moved to the top-level test directory as they now require a full coredns process instead of just the plugin. For the etcd plugin, the entire StubZone resolving is *dropped*! This was a hacky (but working) solution to say the least. If someone cares deeply it can be brought back (maybe)? The pkg/upstream is now very small and almost does nothing. Also the New() function was changed to return a pointer to upstream.Upstream. It also returns only one parameter, so any stragglers using it will encounter a compile error. All documentation has been adapted. This affected the following plugins: * etcd * file * auto * secondary * federation * template * route53 A followup PR will make any upstream directives with arguments an error, right now they are ignored. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix etcd build - probably still fails unit test Signed-off-by: Miek Gieben <miek@miek.nl> * Slightly smarter lookup check in upstream Signed-off-by: Miek Gieben <miek@miek.nl> * Compilez Signed-off-by: Miek Gieben <miek@miek.nl>
2019-01-07Error out when multiple https endpoints are specified. (#2438)Gravatar Yong Tang 1-0/+9
This fix will error out when multiple https endpoints are specified, as additional work is needed to support beyond http. This fix fixes 1464. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-12-08plugin/kubernetes: smaller map (#2383)Gravatar Miek Gieben 1-1/+1
* 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-30allow ttl 0 (#2348)Gravatar Chris O'Haver 1-2/+2
2018-10-22Unblock startup if kubernetes API is unavailable (#2126)Gravatar Kevin Nisbet 1-6/+12
2018-10-02Add Kubernetes auth providers (#2147)Gravatar John Belamaric 1-0/+8
* Import auth providers for K8s * Vendor updates for K8s auth providers * Remove Azure since it is not compiling * Update vendor to remove Azure dependencies
2018-09-28Support for kubeconfig files (#2053)Gravatar Zach Eddy 1-0/+12
* Add support for authentication with kubeconfig files * Update k8s plugin documentation * Fix whitespace in README and tests * Use clientcmd package to load kubeconfig file
2018-06-15plugin/forward: add REFUSED test (#1878)Gravatar Miek Gieben 1-1/+1
add a test to see if we copy the rcode correctly. Some minor cleanup in import ordering and renaming NewUpstream to New as we already are in the upstream package.
2018-05-23ADD ignoreemptyservice option for kubernetes plugin (#1813)Gravatar darkweaver87 1-0/+13
* 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-04-22Use logging (#1718)Gravatar Miek Gieben 1-0/+3
* update docs * plugins: use plugin specific logging Hooking up pkg/log also changed NewWithPlugin to just take a string instead of a plugin.Handler as that is more flexible and for instance the Root "plugin" doesn't implement it fully. Same logging from the reload plugin: .:1043 2018/04/22 08:56:37 [INFO] CoreDNS-1.1.1 2018/04/22 08:56:37 [INFO] linux/amd64, go1.10.1, CoreDNS-1.1.1 linux/amd64, go1.10.1, 2018/04/22 08:56:37 [INFO] plugin/reload: Running configuration MD5 = ec4c9c55cd19759ea1c46b8c45742b06 2018/04/22 08:56:54 [INFO] Reloading 2018/04/22 08:56:54 [INFO] plugin/reload: Running configuration MD5 = 9e2bfdd85bdc9cceb740ba9c80f34c1a 2018/04/22 08:56:54 [INFO] Reloading complete * update docs * better doc
2018-03-09plugin/kubernetes: make glog log to standard output (#1598)Gravatar Miek Gieben 1-0/+12
Jump through all the hoops to make this work.
2018-02-28return an error for multiple use of some plugins (#1559)Gravatar Miek Gieben 1-5/+11
* plugins: Return error for multiple use of some Return plugin.ErrOnce when a plugin that doesn't support it, is called mutliple times. This now adds it for: cache, dnssec, errors, forward, hosts, nsid. And changes it slightly in kubernetes, pprof, reload, root. * more tests
2018-02-28Rename reverse zone constants (#1568)Gravatar Miek Gieben 1-2/+3
Rename the constants to IP4arpa and IP6arpa (shorter and exported) and make IsReverse return the type of the reverse zone which could be handy for some callers. Also add tests for IsReverse()
2018-02-16plugin/kubernetes: Add noendpoints option (#1536)Gravatar Chris O'Haver 1-1/+7
* add noendpoints option * go fmt