Commit Graph

21 Commits

Author SHA1 Message Date
Leonardo Quatrocchi
08e917751b bugfix: add clarification to endpoint unit tests 2024-05-11 20:54:25 -03:00
Leonardo Quatrocchi
05ca35e228 Merge remote-tracking branch 'origin/master' into bugfix/group-endpoints-per-hosted-zone-for-aws 2024-04-22 20:36:38 -03:00
dongjiang1989
f3c1e32930
add unittest casae
Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
2024-04-09 09:34:58 +08:00
dongjiang1989
dc9e0a5816
dongjiang, fix ipv6 shortener and expander equal
Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
2024-03-31 19:51:28 +08:00
Leonardo Quatrocchi
2b3da1b608 Fix for duplicated endpoints and unit tests 2024-03-29 23:27:25 -03:00
Leonardo Quatrocchi
7fe2d3f069 Fix for duplicated endpoints and unit tests 2024-03-29 03:39:17 -03:00
Leonardo Quatrocchi
846f4b40fa Going back to endpoint.go 2024-03-05 02:27:20 -03: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
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
Rob Selway
0a9daa9e9b Case insensitivity when comparing targets 2021-02-14 13:40:25 +00:00
Gary Kramlich
0d0c171811 Add some additional tests for Target.Same 2018-04-12 11:22:33 -05: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
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
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