Commit Graph

126 Commits

Author SHA1 Message Date
Seweryn Chlewicki
0f14da0f15
Handle old format 2023-06-26 15:20:35 +01:00
Seweryn Chlewicki
013f8cf9e9
Fix TXT registry handling of NewTXT domains 2023-06-23 12:14:20 +01:00
John Gardiner Myers
43eea7fa9b Refactor Provider to require DomainFilter 2023-06-19 20:25:59 -07:00
John Gardiner Myers
bb4e7478b7 Address review comments 2023-06-18 16:50:02 -07:00
John Gardiner Myers
5aae0af68a Add DynamoDB registry implementation 2023-06-18 16:49:58 -07:00
John Gardiner Myers
b902453493 Simplify implementation of inmemory provider 2023-06-18 16:47:37 -07:00
Matias Charriere
65e480df0e
remove hardcoded check in registry/txt
Signed-off-by: Matias Charriere <matias@giantswarm.io>
2023-06-18 13:58:16 +02:00
Matias Charriere
44b5761330
reimplement ForceUpdate using ProviderSpecific properties
Signed-off-by: Matias Charriere <matias@giantswarm.io>
2023-06-15 11:50:05 +02:00
Matias Charriere
a0e291b46b
update registry tests to match new strategy
Signed-off-by: Matias Charriere <matias@giantswarm.io>
2023-06-15 11:50:05 +02:00
Matias Charriere
1bd3834743
handle missing TXT records with a forcedUpdate strategy
This change tries to remove part of the logic added in 50f196c0db.
The forceUpdate strategy relies on existing code of the planner to migrate TXT records to the new format,
being the main goal to avoid conflicts during apply.

Signed-off-by: Matias Charriere <matias@giantswarm.io>
2023-06-15 11:50:04 +02:00
Viacheslav Sychov
2554f9f879 #1828: Support encrypted DNS txt records
Signed-off-by: Viacheslav Sychov <viacheslav.sychov@gmail.com>
2023-04-28 20:29:54 +02:00
John Gardiner Myers
781ee3d71f Address review comments 2023-04-12 22:46:39 -07:00
John Gardiner Myers
98532480b0 Support dual-stack domains in TXT registry 2023-03-30 17:49:31 -07:00
Alfred Krohmer
7dd84a589d Route53: retry single changes in a batch if the batch fails
If a single change fails during the retry, it will be added to a queue.
In the next iteration, changes from this queue will be submitted after
all other changes.

When submitting single changes, they are always submitted as batches of
changes with the same DNS name and ownership relation to avoid
inconsistency between the record created and the TXT records.
2023-01-16 16:03:16 +01:00
Ricardo Katz
708de4f98d Fix null pointer on generateTxtRecord 2023-01-06 14:03:17 -03:00
Kubernetes Prow Robot
644b880897
Merge pull request #3017 from olemarkus/ignore-invalid-endpoint
Don't create endpoint if attempting to create one with invalid dns name
2022-10-06 12:37:53 -07:00
Andy Bursavich
74ffff6c26 gofumpt 2022-09-20 20:48:57 -07:00
Ole Markus With
7dbf503fe1 Don't create endpoint if attempting to create one with invalid dns name 2022-09-10 12:31:13 +02:00
Andrey Lebedev
50f196c0db Handle the migration to the new TXT format: create missing records 2022-07-13 21:49:27 +02:00
Dinar Valeev
25c7cb28ea
Add additional txt record with record type marker
In order to track multiple record types with the same name, lets migrate
to new format, were record name contains record type in it.

Signed-off-by: Dinar Valeev <dinar.valeev@absa.africa>
2022-04-14 16:39:36 +02:00
Kubernetes Prow Robot
67fad71451
Merge pull request #2095 from voro015/registry_aws-sd-map-fix
Fixed AWSSDRegistry nil labels map
2021-06-30 01:25:03 -07:00
Artem Voronin
0b370ac6ba Fixed registry aws-sd nil labels 2021-05-20 15:12:42 +03:00
Thibault Jamet
17fb8813d0
Reduce AWS Route53 API calls
Currently, planning instructs to create all records even
those which does not match any zone.
Later, those records will be checked towards the existing
records and filtered whether they match or not a hosted zone.

This causes a problem, at least in the specific case of the Route53
implementation as it always calls the ApplyChanges method, which in its
turn always retrieves all records in all zones.

This causes high pressure on Route53 APIs, for non-necessary actions.

By being able to filter all unmanaged records from the plan, we can
prevent from calling ApplyChanges when nothing has to be done and hence
prevent an unnecessary listing of records.

By doing so, the rate of API calls to AWS Route53 is expected to be
reduced by 2
2021-04-25 18:10:36 +02:00
Raffaele Di Fazio
daeee26684
Add flag to opt in for NS records management (#1915)
* adds flag to opt in for NS records management

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* go fmt

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* goimports

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* fix more tests

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* go fmt again

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* fix test

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* more tests

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* make ordering of managed records consistent

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* fix flag

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>
2021-01-12 06:32:26 -08:00
Raffaele Di Fazio
f5aa1c4c37
Add new method to provider interface to implement provider specific changes (#1868)
* adds tests for shouldUpdateProviderSpecific

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* move AWS health to where it belongs

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* add test that breaks things

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* adds adjustendpoints method

Signed-off-by: Raffaele Di Fazio <raffo@github.com>

* fix controller

Signed-off-by: Raffaele Di Fazio <raffo@github.com>

* actually pass the provider where needed

Signed-off-by: Raffaele Di Fazio <raffo@github.com>

* OMG goland do your go fmt thing

Signed-off-by: Raffaele Di Fazio <raffo@github.com>

* use registry as proxy

Signed-off-by: Raffaele Di Fazio <raffo@github.com>

* make linter happy

Signed-off-by: Raffaele Di Fazio <raffo@github.com>

* change AdjustEndpoints signature

Signed-off-by: Raffaele Di Fazio <raffo@github.com>

* fix typo

Signed-off-by: Raffaele Di Fazio <raffo@github.com>

* actually use adjusted endpoints

Signed-off-by: Raffaele Di Fazio <raffo@github.com>

* revert cloudflare change

Signed-off-by: Raffaele Di Fazio <raffo@github.com>

* Update provider/cloudflare/cloudflare.go

Co-authored-by: Nick Jüttner <nick@juni.io>

Co-authored-by: Nick Jüttner <nick@juni.io>
2020-12-09 23:40:54 -08:00
dan.simone@oracle.com
07c8175f66 Call strings.ToLower() on wildcardReplacement 2020-09-25 15:32:57 -07:00
dan.simone@oracle.com
e3bac0fb55 Merge remote-tracking branch 'origing/master' into dansimone/support-wildcard-records
# Conflicts:
#	registry/txt.go
#	registry/txt_test.go
2020-09-01 11:24:44 -07:00
Chema Sanchez
73be02b155 Fix index out of range when hostname has no dots 2020-08-27 09:28:12 +02:00
dan.simone@oracle.com
9024b2ef81 Clarify wildcard parameter 2020-07-29 13:16:03 -07:00
dan.simone@oracle.com
b01daf5927 Support wildcard records - Optional ability to replace the asterisk in generated registry TXT records with another string 2020-07-29 12:01:33 -07:00
Kubernetes Prow Robot
25d71ea45a
Merge pull request #1536 from sheerun/property-comparator
Allow for custom property comparators
2020-06-01 03:07:55 -07:00
Johannes Grumböck
6cb94432ca Use strings instead of regex for splitting 2020-05-18 07:15:49 +00:00
Johannes Grumböck
03db178dc7
Fix tests 2020-05-12 23:10:14 +02:00
Adam Stankiewicz
f008e894df Allow for custom property comparators
Fixes issue #1463

Co-authored-by: Alastair Houghton <alastair@alastairs-place.net>
2020-05-12 16:27:46 +02:00
Johannes Grumböck
d2ee19505b Removed commented testfunction 2020-05-12 13:35:59 +00:00
Johannes Grumböck
72d49c125c remediate lint staticcheck error 2020-05-12 13:35:59 +00:00
Johannes Grumböck
aab98ab4cd remediation of gofmt and gosimple linting errors 2020-05-12 13:35:59 +00:00
Johannes Grumböck
c80909f0e7 Added txt-suffix feature (rebased) 2020-05-12 13:35:40 +00:00
Raffaele Di Fazio
82539e35a3 makes tests pass
Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>
2020-05-08 13:54:13 +02:00
tariqibrahim
672b00d821 add ctx parameter to provider interface and aws API 2020-01-12 13:16:55 -08:00
Tariq Ibrahim
41ba7f1ff5
rename project root package to sigs.k8s.io 2020-01-06 08:08:35 -08:00
Nick Jüttner
9418e3acd8
Merge pull request #1008 from devkid/feature/aws-routing-policies
[RFC] Add support for all AWS Route53 routing policies; add additional Setldentifier abstraction layer
2019-11-19 11:21:12 +01: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
Alfred Krohmer
b2a3e88303 Fixes and cleanup 2019-09-10 20:47:36 +02:00
Alfred Krohmer
6681a3a358 Add support for all AWS Route53 routing policies; add additional SetIdentifier abstraction layer
This adds support for all AWS Route53 routing policies, namely:
* simple (default)
* weighted
* latency
* failover
* geolocation
* multi value answer

These routing policies allow to create multiple records with the same
name, but different "SetIdentifiers". Therefor, as a prerequisite for
implementing support for above routing policies, there is a new
"abstraction layer" added that handles this SetIdentifier by adding a
new attribute in the Endpoint struct and adding another level in the
plan table.
2019-09-10 20:47:36 +02:00
Nick Jüttner
b685c73840
Update txt_test.go 2019-09-10 12:23:30 +02:00
Nick Jüttner
816929adbb
Update txt_test.go 2019-09-10 12:23:05 +02:00
Nick Jüttner
b2c5ad0210
Merge branch 'master' into fix-prefix-to-lower 2019-09-10 12:09:27 +02:00
Olaf Klischat
a348bd7a85 TXTRegistry: do not overwrite labels of records returned by the provider 2019-08-19 01:35:55 +02:00
Martin Linkhorst
40edf9cfcb fix: add test case for in-use upper-case txt prefixes 2019-07-31 12:26:55 +02:00
Martin Linkhorst
d4d8b964c1 chore: remove additional debug output from txt registry 2019-07-31 11:58:35 +02:00
Martin Linkhorst
1cdb941d88 chore: add tests for case-insensitive TXT prefix 2019-07-31 11:55:43 +02:00
Pavol Ipoth
d7516a2580 Replace debug+sprintf with debugf 2019-05-09 11:39:18 +02: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
Pavol Ipoth
956be2e3ea Fix txt prefix bug, should be lowercased because when writing to dns it is lowercased 2019-05-03 13:54:03 +02:00
shashidharatd
96b50dd4c4 Fix nil map access of endpoint labels 2018-10-15 11:43:19 +05:30
Sébastien Prud'homme
6285b2c38d Don't erase endpoints labels (#713) 2018-10-02 17:45:29 +02:00
shashidharatd
8fd477ec2d Fix a possible nil map access 2018-08-22 19:37:21 +05:30
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
Jess Frazelle
4759789ac8
add cache to limit calls to Records()
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-06-12 05:34:23 -04:00
Jaromir Vanek
cd94888800 Implementation of AWS ServiceDiscovery provider 2018-05-25 07:45:47 -07:00
Gary Kramlich
1cef71e0be Inititial support for multiple targets per record 2018-03-13 23:16:51 -05: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
Yerken
ec07f45c8e Multi target plan ( Page Not Found ) (#404)
* Make suitableType() be Endpoint method

With this change it becomes possible to work with endpoint
of empty type in packages other than "provider". Also
it seems logical for a smart property getter without side effects
to be a method rather than a function in different package

* Make plan computation work correctly with multi-target domains

* fix drawing

* drop comments

* fix boilerplate header

* fix comment

* fix the bug with empty map

* rework registry to support random lables

*  serialize->serializeLabel function rename

* golint for err variable naming

* add additional test

* add tests for current case where one resource can generate multiple endpoints

* make labels have its own type, add serialization as a method

* add comment for exported error

* use greater rather than not equal zero

* update changelog
2017-12-14 11:21:07 +01:00
Martin Linkhorst
0f85859af0
Avoid shadowing package name (#410)
* chore: avoid shadowing package name

* fix: use constant format in call to Sprintf

* chore: try to make go1.9 work on travis
2017-12-01 16:52:51 +01: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
Martin Linkhorst
406afacbf7 experiment: use testify in test code (#186)
* ref(source): use testify with mocks in test code

* fix: re-introduce NewMockSource for convenience

* fix: avoid circular dependency

* ref: increase usage of testify

* chore: vendor testify as a dependency

* fix(*): cleanup testify expectations
2017-05-31 10:24:11 +02:00
Martin Linkhorst
707bdc4d95 ref(*): remove superflous zone parameter (#212) 2017-05-22 15:38:27 +02:00
Yerken
f11c37c2ee refactor inmemory provider (#199)
* reactor inmemoy provider

* add inmemoryclient to logically split functions

* implement apply changes

* fix all tests

* chore: use bogus value for zone to ensure it's ignored

* chore: use bogus value for zone to ensure it's ignored (2)
2017-05-09 13:19:47 +02: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
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
Yerken
285cb4cb35 change owner key in txt records (#167)
* change owner key in txt records

* ref(registry): change semicolon to comma
2017-04-21 11:50:53 +02:00
Yerken
cbf54d904c move the logging to registry (#157) 2017-04-13 14:59:07 +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
Yerken
9a44453d59 define registry interface (#120)
* define registry interface

* init in-memory registry

* remove ununsed variable, added comments

* add inmemory registry tests

* introduce DNSRecord struct

* use noop registry

* remove zone from registry fields

* replace provider with registry in controller

* move noop registry interface check to test

* remove ownerid from noop registry

* fix: remove dangling empty line

* return provider records directly with noop

* adjust according to pr review

* fix noop tests
2017-04-07 16:00:24 +02:00