47 Commits

Author SHA1 Message Date
Markus Cisler
14d64e09f2 Change DomainFilter to apply to records as well
This moves `domain_filter.go` to the `endpoint` package to make it
possible to filter and exclude record names in
`plan.filterRecordsForPlan()` so it does not have to be implemented in
every single provider.

Because some providers access `DomainFilter.filters` directly it had to
be exported.
2020-02-24 11:19:45 +01:00
Tariq Ibrahim
a5896c2326
remove context.TODO()s in external-dns 2020-01-15 13:59:20 -08:00
Martin Linkhorst
b8ab0d8b9f ref: use passed-in context in google provider 2020-01-13 10:51:04 +01:00
tariqibrahim
672b00d821 add ctx parameter to provider interface and aws API 2020-01-12 13:16:55 -08:00
Tariq Ibrahim
bf4b1767fa
add more linters and improve code quality 2020-01-07 15:18:00 -08:00
Tariq Ibrahim
41ba7f1ff5
rename project root package to sigs.k8s.io 2020-01-06 08:08:35 -08:00
Kubernetes Prow Robot
e9c834ae9b
Merge pull request #1248 from vdesjardins/clouddns-batching
Google Provider: add support for batching updates
2019-11-19 02:23:42 -08:00
Martin Linkhorst
7ec26546f3 ref(google): use non-deprecated initializer with context 2019-11-12 13:24:52 +01:00
Vincent Desjardins
ce94d2f328
Google Provider: add support for batch interval.
The parameter is google-batch-change-interval.
Default value is 2s.
2019-11-01 21:27:21 -04:00
Nick Jüttner
f763d2a413 Move into kubernetes-sigs organization (#1245)
* Move into kubernetes-sigs organization

* Disable labeler action for forks
2019-11-01 17:10:19 +01:00
Vincent Desjardins
ce2eadcd66
Google Provider: add support for batching updates
The parameter is google-batch-change-size.
Default value is 1000.
2019-10-31 13:41:02 -04:00
Christian Simon
ef77161ab0 Google zones should be filter by their ID and Name
Before we only filter by the zone ID, which is an integer value, that is
not exposed in the GCP Console and by the related terraform resource.
This allows to filter by either ID or Name whatever matches.
2019-05-16 14:06:13 +01:00
Michael Fraenkel
fab942f486 Cache the endpoints on the controller loop
The controller will retrieve all the endpoints at the beginning of its
loop. When changes need to be applied, the provider may need to query
the endpoints again. Allow the provider to skip the queries if its data was
cached.
2019-05-07 19:51:53 -04:00
njuettner
76c09dab1f Switch to go modules 2019-04-09 17:22:36 +02:00
Martin Linkhorst
9cada6d9fe
chore: remove unused import (#781) 2018-11-21 14:30:07 +01:00
Nick Jüttner
4a330c61a3
Remove sorting of rrdatas 2018-11-21 12:13:04 +01:00
Nick Jüttner
919ad81ce7
Remove trim suffix 2018-11-21 10:35:53 +01:00
Nick Jüttner
1ed5fa6952 panic: assignment to entry in nil map 2018-11-20 16:30:25 +01:00
Kevin Davis
1c57771337 Fix handling of custom TTL values with Google DNS. 2018-09-09 22:11:44 -07:00
xianlubird
98f0013b2a Fix google file format problem 2018-08-30 20:09:08 +08:00
Julian Vassev
e6cae22ec4 Configure req timeout calling k8s APIs
When running in a pod sometimes the request to get ingreses/services
stalls indefinitely. A simple pod restart fixes this. Hard to reproduce
but I got lucky and did thread dump which revealed a gorouting blocked
on call to k8s.

What's new is a `--request-timeout` flag that makes requests to k8s
bounded in time. The default is 30s - this may cause some deployments
with a slow api-server to timeout.
2018-08-16 02:59:21 -07:00
Nick Jüttner
3652e0c90a Only store endpoints with their labels in the cache (#612)
* Set cacheinterval flag to 0 by default and if it is zero don't use cache

* fix: run gofmt -s in go1.11
2018-06-28 13:56:38 +02:00
Martin Linkhorst
ce8f1d851c
Correctly filter records that don't match all filters (#533)
* fix(google): correctly filter records that don't match all filters

* update changelog with the filters fix

* fix(google): add test to ensure domain filter works
2018-04-23 15:50:09 +02:00
Anders Bruun Olsen
f2a4efbcb4 Auto-detect google-project if provider is Google and no project is su… (#492)
* Auto-detect google-project if provider is Google and no project is supplied.

* Add changelog entry.
2018-03-13 20:40:17 +01:00
Till Klocke
5d54849699 Implementation of multiple targets based on PR #404 and #396 (#418)
* Endpoint.Target is now Endpoint.Targets. This is its own type representing mutliple targets for a single DNS name while adding some convenience for sorting and comparing

* Made everything compile and tests run through with the new Endpoint.Targets

* The ingress source can now properly handle multiple target ips per host

* Added custom conflict resolver, to better understand how conflict resolution has to work for me

* My custom conflict resolver behaves a bit different than the PerResource resolver, therefore I needed to modify the expected test result

Removed unnecessary FIXME

* The ingress source now creates CNAME endpoints with multiple targets to let the DNS provider decide how to handle multiple CNAME targets. This could be interesting for weighted targets etc.

* Adopted the expected results to the new way we create endpoints for CNAMEs

* Removed Add method from Targets since manipulating the slice through here is unnecessary complicated and doesn't deliver enough convenience

* Reverted ConflictResolver to the original one. There is some discussing to do what the best way is to handle conflicts

* Added missing documenting comment to IsLess of Targets

* Added documenting comments to Targets,Targets.Same and NewTargets to clarify their intention and usage

* Service source now also generates endpoints with multiple targets

* Service and Ingress source now sort all Targets for every Endpoint to make order of Targets predictable

* Endpoints generated by the Google Cloud DNS provider now also have sorted Targets to make order of Targets predictable

* Modified provider dyn to be able to compile with multi target changes

* Fixed small nitpicks, so my code is acceptable

* Fixed merge method after updating to new Targets. Replacing '!=' with .Same of course needs a boolean negation

* Tests for dyn provider now also use the new Targets instead of Target

* Simplified extractServiceIps as implied by linki to make it more readable

* ref: change service ClusterIP retrieval again

* Added entry to CHANGELOG.md describing the new features contained in this PR
2018-02-21 18:11:45 +01:00
leigh schrandt
930c8d4856 Google Provider logging for misconfigured zones (#388)
* provider=google: Improve Logging / Filter Endpoints

1. move dry-run exit after `separateChange()`
2. log records after `separateChange()`
3. make `newRecords()` a method of `GoogleProvider` — use `domainFilter.Match()` foreach `endpoint.DNSName`
   ^ without this, non-relevant endpoints show up in the warnings for “No matching zone”

* provider=google: Add tests for domainFilter

- new test: `TestGoogleRecordsFilter`
- add no matching zone and filtered record to `TestGoogleApplyChanges`
- allow `setupGoogleRecords` to createRecords without validateEndpoints

* provider=google: Improve zone-matching logs

- Add `DomainFilter.isConfigured()`
- Conditionally log zone matching for the user based off of `DomainFilter.isConfigured()`
- Rename `provider.newRecords()` to `provider.newFilteredRecords`

* fix: ensure that our setup methods are correct by keeping the tests
2018-01-08 11:51:25 +01:00
Valentyn Boginskey
4dacf81238 New filter: --zone-id-filter (#422)
* Add aws-zone-id flag

* Add Zone ID filter

* Update AWS provider and main

* Make ZoneIDFilter generic

* Implement ZoneIDFilter for all providers

* Update CHANGELOG
2017-12-20 17:00:13 +01:00
Martin Linkhorst
af1532cb3c fix: print matched dns zones (gcp, aws) (#401) 2017-11-28 23:13:29 +01:00
leigh schrandt
65f4239d44 provider=google: Add Ttl from annotations:
Use `int64(ep.RecordTTL)` in `newRecord()`
Fallback to hardcoded 300s for backwards-compat
Add `TestNewRecords()`
Add notes in *ttl.md*
2017-11-14 15:23:51 -07:00
Nick Jüttner
f5639c4cb7 #228 Simplify DNS provider requirements by extracting common (#263)
* #228 Simplify DNS provider requirements by extracting common

* #228 Simplify DNS provider requirements by extracting common

* Missing boilerplate added

* rename recordtypefilter, fail fast statements

* rework zone finder, update deps

* chore: drop namespace from cloudflare method name
2017-10-11 12:16:28 +02:00
Martin Linkhorst
3331a57a18 Fix issue with uppercase logrus import (#351)
* chore: use lowercase for logrus repository

* chore: update dependencies using glide
2017-10-09 17:14:18 +02:00
Seth Pollack
f14a953b5f Kops Compatibility #1: Set RecordType at source (#248)
* set RecordType at source

* add comments for linting
2017-08-25 14:41:40 +02:00
Nils Juenemann
73d397961e Support for multiple domains within --domain-filter (#252)
* Support for multiple domains within --domain-filter

The parameter accepts a comma separated list of domains with or without trailing dot. Example: --domain-filter="example.org, company.test.,staging.com". Closes #247 and #229

* Add boilerplate header

* Add documentation for methods and structs

* use StringsVar for the domain-filter flag

* go fmt

* Remove camel case from tests

* Revert changes in README.md

* Move DomainFilter to provider package

* Make a new slice and copy elements to it

* Update CHANGELOG.md

* docs: change minor spelling mistake
2017-06-29 18:59:05 +02:00
Yerken
229944f7ab make all provider implementation public, return struct instead of interface (#234) 2017-06-13 10:32:13 +02:00
Martin Linkhorst
a18656f1b0 add client-side metrics for all external calls (#188)
* chore: add instrumented HTTP client library

* feat: add client-side metrics to outgoing HTTP clients
2017-05-22 15:39:59 +02:00
Martin Linkhorst
707bdc4d95 ref(*): remove superflous zone parameter (#212) 2017-05-22 15:38:27 +02:00
Martin Linkhorst
da3c17a65c allow setting flags via env vars (#124)
* feat(config): change defaults, switch flag processing to kingpin

* chore: vendor kingpin as a dependency

* feat(config): auto-detect cluster config from the environment

* chore: clean up definition of flags

* chore: sanitize flags even further

* chore: update changelog with latest flags changes

* fix(aws): fix messed up test name
2017-04-27 13:57:45 +01:00
Yerken
82a172a9f9 minor improvements to logging (#175)
* minor improvements to logging

* chore(*): change log.Infoln to log.Info

* fix: fix incorrect example code
2017-04-26 12:06:16 +02:00
Martin Linkhorst
e5f21ad32a add multi-zone capability to google provider (take 2) (#163)
* feat(google): auto-detect and multiple zone support

* chore: run gofmt with the simplified command

* fix: pass desired domain to google provider

* feat(google): correctly auto-detect records for sub-zones

* chore: update changelog with support for multiple zones in google

* fix(google): don't append traling dot to TXT records

* ref(provider): extract hostname sanitization to general provider
2017-04-25 17:45:36 +02:00
Yerken
5e3f2b7773 first effort to improve logging in external-dns to provide with basic needed logging (#174)
* continue on controller loop error

* add logging in source

* use formatter on logChanges for endpoints

* fix log messages, log skipped records

* add logging in aws, uppercase the rest

* respect google dry run policy

* add ing/svc namespace/name on logging

* fix error logging on template failure

* fix bugs, propagate template error

* log if nothing is being updated, debug log skipped endpoints

* change zone-not-found logging order
2017-04-25 12:22:46 +02:00
Martin Linkhorst
4badc72984 fix(google): ensure DNS records have trailing dot before sending (#159) 2017-04-14 19:11:53 +02:00
Martin Linkhorst
62905a3b8f initial support for AWS ALIAS records (#144)
* feat(aws): support for creating DNS records with ALIAS type

* fix(aws): increase code coverage by listing ALIAS records

* chore: update changelog with support for ALIAS records

* ref(aws): generalize naming of ELB to load balancer

* ref(google): remove superflous check for non-existing record

* fix(aws): return the correctly typed alias record
2017-04-12 21:09:27 +02:00
Yerken
98de0142ba kickoff txt registry (#137)
* kickoff txt registry

* fix inmemory dns provider to include recordtype info for validation

* Merge master

* fix ununsed variable in inmemory provider

* add tests for records

* add test for no prefix name formatter

* implement apply changes with tests

* add flag to enable txt registry

* add txt registry to main

* improve sort testing

* filter out non-owned records

* NewEndpoint(...) requires record type

* use newendpoint in aws_test, fix tests

* change suitable type implementation

* fix the test for compatibility component

* change inmemory provider to include recordtype and use suitable type

* fix comments, CNAME should target hostname

* name mapper do not use pointer on struct

* txt prefix - just concatenate, remove spew, fix txt record label

* allow TXT records as result from dns provider

* add changelog

* fix tests

* TXT records need to be enclosed in double quotes
2017-04-11 23:10:38 +02:00
Martin Linkhorst
b0f437a438 support hostnames as endpoint targets (CNAME support) (#122)
* feat(aws): support hostnames as endpoint targets

* docs: describe how to run ExternalDNS on AWS

* docs: update changelog with CNAME feature

* docs: update changelog to include AWS documentation

* fix(aws): test that updating records removes the old value

* feat(google): add CNAME support to Google provider

* fix(source): sanitize source and target hostnames

* docs: update changelog to include latest changes

* docs(aws): mention that ExternalDNS takes full ownership of a hosted zone

* fix(aws): switch route53 tests to use endpoint pointers

* docs: add TODO to remove record filtering once ownership is in place
2017-04-05 14:58:10 +02:00
Yerken
f9402d7ed1 use pointer to endpoint via NewEndpoint initializer (#125)
* use pointer to endpoint via NewEndpoint initializer

* return nil if record does not exist in plan

* add test for NewEndpoint
2017-04-04 16:41:49 +02:00
Martin Linkhorst
5935b6b08d ref(dnsprovider): list deletions first to make log output clearer (#102) 2017-03-17 16:17:13 +01:00
Martin Linkhorst
318c6e532c ref(*): rename DNSProvider to just Provider (#101) 2017-03-17 14:35:10 +01:00