Skip to content

Commit

Permalink
Specific bugfix near the root cause for duplicated deletes on plan.go
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocaylent committed Apr 5, 2024
1 parent deba1ea commit 4fb2f2e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ func (c *Controller) RunOnce(ctx context.Context) error {
return err
}

records = endpoint.RemoveDuplicates(records)
//records = endpoint.RemoveDuplicates(records)
//This deduplication could be a different but valid solution
//With this in place the change on plan.go is not needed
//Keeping this here until we decide what's best
registryEndpointsTotal.Set(float64(len(records)))
regARecords, regAAAARecords := countAddressRecords(records)
registryARecords.Set(float64(regARecords))
Expand Down
3 changes: 1 addition & 2 deletions endpoint/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ func RemoveDuplicates(endpoints []*Endpoint) []*Endpoint {

if _, found := visited[key]; !found {
result = append(result, ep)
//visited[key] = struct{}{}
// Currently Debugging 0.14.0 to see the exact root cause
visited[key] = struct{}{}
} else {
log.Debugf(`Skipping duplicated endpoint: %v`, ep)
}
Expand Down
4 changes: 4 additions & 0 deletions plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ func (p *Plan) Calculate() *Plan {
// filter out updates this external dns does not have ownership claim over
if p.OwnerID != "" {
changes.Delete = endpoint.FilterEndpointsByOwnerID(p.OwnerID, changes.Delete)
// Remove duplicated endpoints generated by plan.go on Line 196
changes.Delete = endpoint.RemoveDuplicates(changes.Delete)
// This was not needed on version 0.13.6, but it seems like
// the old function/code had the ability of removing duplicated endpoints
changes.UpdateOld = endpoint.FilterEndpointsByOwnerID(p.OwnerID, changes.UpdateOld)
changes.UpdateNew = endpoint.FilterEndpointsByOwnerID(p.OwnerID, changes.UpdateNew)
}
Expand Down

0 comments on commit 4fb2f2e

Please sign in to comment.