Commit Graph

42 Commits

Author SHA1 Message Date
Joel Studler
2fdc7354c0 Add unit tests for NAPTR and invalid endpoints 2024-01-27 13:16:53 +01:00
Kyle Cronin
20bff0aae5 Remove EndpointFilterInterface 2023-08-16 23:48:30 -04:00
Kyle Cronin
7fb144d8d8 Fix planning for multi-cluster dual stack record types
When AAAA multi-target / dual stack support was
added via #2461 it broke ownership of domains across
different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change updates the planner to keep track of multiple
current records for a domain. This allows for A and AAAA
records to exist for a domain while allowing record type
changes.

The planner will ignore desired records for a domain that
represent conflicting record types allowed by RFC 1034 3.6.2.
For example if the desired records for a domain contains
a CNAME record plus any other record type no changes for
that domain will be planned.

The planner now contains an owned record filter provided
by the registry. This allows the planner to accurately plan
create updates when there are record type changes between
the current and desired endpoints. Without this filter the
planner could add create changes for domains not owned
by the controller.
2023-08-15 19:37:50 -04:00
John Gardiner Myers
a9ae5ea43a Add SetIdentifier to EndpointKey 2023-06-18 16:47:37 -07:00
John Gardiner Myers
4417ad4894 Move EndpointKey to endpoints package 2023-06-18 16:47:37 -07:00
John Gardiner Myers
beb893df7d Address review comment 2023-06-12 21:28:18 -07:00
John Gardiner Myers
55bbb29f55 Route53 update configuration of target health checks 2023-06-09 17:11:28 -07:00
John Gardiner Myers
4b15f20e76 Simplify GetProviderSpecificProperty 2023-06-09 07:33:41 -07:00
Kubernetes Prow Robot
3346b4e53c
Merge pull request #3519 from Sewci0/feature/mx-support
Add support for MX records in Azure, GCP and AWS
2023-05-15 12:13:07 -07:00
Skyler Mäntysaari
6f42a8a2da Initial IPv6 support 2023-03-30 17:49:28 -07:00
John Gardiner Myers
94d09b37dc Separate plan by record type 2023-03-30 17:47:59 -07:00
Seweryn Chlewicki
205e8c0334
Add support for MX records in Azure, GCP and AWS 2023-03-30 20:32:32 +01: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
Will Hegedus
b5d01eed1a feat: add debug logging for IP addr parse errors
Log whenever a target is not able to be parsed as an IP address. This is expected
to occur fairly often (for example, with CNAME targets), but allows more visibility
into how targets are being compared.

NOTE: depending on the number and type of targets, this could be quite noisy.
2022-06-06 13:06:43 -04:00
Will Hegedus
0c8f6a69bd feat!: handle IP address comparison
Previously there was no distinction between an IP address and any other string
when doing a comparison to determine which is "less" when determining which endpoint to actually create.

This explicitly handles IP addresses and will always prefer
them over non-IP addresses when determining which of two targets is less.
2022-04-20 13:35:28 -04:00
Christian Groschupp
f9145981c3
infoblox: also create a ptr entry 2021-09-30 15:42:14 -07:00
Dinar Valeev
a143a6cd59 Generate CRD with controller-gen
Signed-off-by: Dinar Valeev <dinar.valeev@absa.africa>
2021-03-08 20:12:05 +01:00
Rob Selway
0a9daa9e9b Case insensitivity when comparing targets 2021-02-14 13:40:25 +00:00
windayski
262822e2f6 fix typos 2020-10-30 03:28:57 +00:00
Yury Tsarev
904d8e4c87 NS record support 2020-10-12 20:23:17 +02:00
Lucas Servén Marín
a54ee2da37
*: fix goreportcard golint warnings
This commit applies fixes for the golint warnings shown on goreportcard.

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
2020-05-07 17:22: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
Erik Swets
e0e7a9defd Allow setting Cloudflare proxying by annotation 2018-11-16 12:52:47 +01:00
Martin Linkhorst
f21f45b15d
fix(aws): correctly populate target health check on existing records 2018-10-02 17:44:02 +02:00
shashidharatd
ddef0a9ccc Add wrapper structure for Endpoint in sync with definition of CRD 2018-08-22 19:37:21 +05:30
Gary Kramlich
2ee4b2e533 Add support for NodePort services (#559)
* First stab at NodePort support. Testing incomplete

* Fix up the unit tests

* Remove some deadcode in the unittests

* gather node ips once and add support for srv records

* Make sure we match gofmt simple

* Move the nodes to the testcase and add a test for clusters that only have internal ip addresses

* Somehow forgot about the weight field in the records

* Add SRV as a supported record type
2018-06-14 18:08:05 +02: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
Kevin J. Qiu
71723bdd5b Allow specifying a custom TTL through annotation on Ingress or Service (#320)
* Add RecordTTL

* Route53: test for custom TTL

* Fix tests

* Fix remaining tests

* Add ttl when endpoint is created from ingress

* Missed a word

* Fix bad refactoring

* Add ingress custom TTL test

* gofmt

* Satisfy go-lint

* Unshadow `endpoint` in azure provider

* Fix and add an output test

* Add TTL for endpoints generated from service templates

* Take TTL into account when generating update plan

* Tests for TTL change impact on the plan

* Refactor factory method name

* Refactoring

* Run gofmt

* Make endpoint string format look like BIND config

* Update plan and plan_test

* Replace NewEndpointWithTTLValue with NewEndpointWithTTL in aws

* Remove NewEndpointWithTTLValue func

* Update references to TTL

* Remove getTTLValue func

* Handle merge conflict

* Update tests

* Update README, CHANGELOG and documentation

* Run gofmt

* Move getTTLFromAnnotations to a common file

* Refactor getTTLFromAnnotations

* Gofmt

* Add tests for getTTLFromAnnotations

* Trigger build

* Add boilerplate header

* Update README/CHANGELOG according to code review

* Add ttl.md and link it from README

* change CNAME string to endpoint.RecordTypeCNAME

* fix test cases with AWS ALIAS records, these do not behave different in these tests
2017-10-11 14:17:02 +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
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
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
3d296f37d9 Fix/plan reuse current record (#145)
* inherit labels from dns provider records

* do not change import statements, rollback autoformatter changes

* add comment for the public method
2017-04-11 20:27:51 +02:00
Yerken
be452acdf7 endpoint sanitize dns in the init func (#131)
* revert changes, start a new

* remove sanitize

* fix tests for source pkg

* fix aws_tests
2017-04-07 10:18:52 +02:00
Yerken
2eb97f6a83 add labels to endpoints (#121)
* add labels to endpoints

* reset to first commit fix label key

* compare using sameendpoint, add map initializer to newendpoint

* fix(endpoint): drop superflous comment indicators
2017-04-04 21:41:13 +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
99371a1e83 implementation of basic control loop (#40)
* feat(google): add ability to apply changes generated from a plan

* feat(controller): first implementation of controller

* feat: allow to configure in-cluster and kubeconfig

* fix(controller): call RunOnce at the right time and in a loop

* feat(google): add dryRun attribute to Google DNS provider

* fix: use hosted zone id instead of DNS name

* fix(google): stupidly filter by A records for now

* feat: allow specifying the google project and zone

* feat: provide a dry-run flag which defaults to false

* chore: vendor new dependencies

* fix(config): fix failing tests for config object

* ref(controller): return plain value of ApplyChanges

* ref: simplify how to get a valid kubernetes client
2017-03-01 16:17:47 +01:00
Martin Linkhorst
6ab387ec33
docs(endpoint): document the Endpoint struct 2017-02-24 17:16:57 +01:00
Martin Linkhorst
f156cd89d7
chore(source): add boilerplate headers 2017-02-24 17:16:26 +01:00
Martin Linkhorst
84910c4844
feat(services): implement Kubernetes services source 2017-02-23 12:04:13 +01:00