Skip to content

Commit

Permalink
Update plan for Distibuted DNS
Browse files Browse the repository at this point in the history
Initial work to modify the external-dns plan to work in the proposed way
for distubuted dns.

Updates the plan to treat all endpoints passed to it (current/desired)
as part of a single shared set of records. The calculation logic now
takes into account other endpoints added to the plan when calculating
the desired changes for any other endpoint also added.

The plan calculation logic is broken into two steps:

1. Calculate what endpoints will be created/updated and deleted based on
   the current and desired records passed to the plan. For each endpoint
that will still exist if these changes were to be
applied(create/update), a map of dnsNames and their owners is
calculated.

2. Create the external-dns Changes for the endpoints calculated in
   step one. For all endpoints calculated to be an update the target
values are re-calculated using the information gathered in step one
about ownership of dnsNames. If we detect that a CNAME has a "managed"
target value (it's in our owner map) we use the information known about
who owns it to manipulate the desired targets values.
  • Loading branch information
mikenairn committed Apr 15, 2024
1 parent 6ed0a18 commit c3c32fc
Show file tree
Hide file tree
Showing 6 changed files with 262 additions and 92 deletions.
1 change: 1 addition & 0 deletions internal/controller/dnsrecord_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ func (r *DNSRecordReconciler) applyChanges(ctx context.Context, dnsRecord *v1alp
Policies: []externaldnsplan.Policy{policy},
Current: zoneEndpoints,
Desired: specEndpoints,
Previous: statusEndpoints,
//Note: We can't just filter domains by `managedZone.Spec.DomainName` it needs to be the exact root domain for this particular record
DomainFilter: externaldnsendpoint.MatchAllDomainFilters{&rootDomainFilter},
ManagedRecords: managedDNSRecordTypes,
Expand Down
6 changes: 6 additions & 0 deletions internal/external-dns/plan/labels.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package plan

const (
// OwnerLabelDeliminator is a deliminator used between owners in the OwnerLabelKey value when multiple owners are assigned.
OwnerLabelDeliminator = "&&"
)
Loading

0 comments on commit c3c32fc

Please sign in to comment.