Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: duplicated endpoint per hosted zone #4296

Merged
Changes from 4 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b8053fe
Group By Endpoint names per Hosted Zone on AWS
leonardocaylent Mar 3, 2024
e55200a
Group By Endpoint names per Hosted Zone on AWS
leonardocaylent Mar 3, 2024
7c7a1c3
Group By Endpoint names per Hosted Zone on AWS
leonardocaylent Mar 3, 2024
9307374
Group By Endpoint names per Hosted Zone on AWS
leonardocaylent Mar 3, 2024
846f4b4
Going back to endpoint.go
leonardocaylent Mar 5, 2024
294b4c6
Fix format on aws and endpoint files
leonardocaylent Mar 5, 2024
0308cc2
Fix Lint
leonardocaylent Mar 5, 2024
3395eba
Add const to avoid Lint
leonardocaylent Mar 5, 2024
cea0496
Revert "Fix Lint"
leonardocaylent Mar 5, 2024
a3826d5
Update endpoint.go with Key function
leonardocaylent Mar 16, 2024
30c9e77
Fix lint
leonardocaylent Mar 16, 2024
f4f39d8
Merge branch 'kubernetes-sigs:master' into bugfix/group-endpoints-per…
leonardocaylent Mar 16, 2024
0ca2796
Fix Lint
leonardocaylent Mar 16, 2024
82046cc
Removing comments and clean up
leonardocaylent Mar 16, 2024
d3c2f47
Merge remote-tracking branch 'origin/master' into bugfix/group-endpoi…
leonardocaylent Mar 29, 2024
7fe2d3f
Fix for duplicated endpoints and unit tests
leonardocaylent Mar 29, 2024
2b3da1b
Fix for duplicated endpoints and unit tests
leonardocaylent Mar 30, 2024
6066b70
Fix for duplicated endpoints
leonardocaylent Apr 4, 2024
3ca4d02
Update endpoint/endpoint.go
leonardocaylent Apr 4, 2024
17ce6b4
Merge remote-tracking branch 'origin/master' into bugfix/group-endpoi…
leonardocaylent Apr 5, 2024
deba1ea
Fix suggestions
leonardocaylent Apr 5, 2024
4fb2f2e
Specific bugfix near the root cause for duplicated deletes on plan.go
leonardocaylent Apr 5, 2024
ba56b7a
Merge remote-tracking branch 'origin/master' into bugfix/group-endpoi…
leonardocaylent Apr 6, 2024
d9b7439
Specify and clarify root cause of issue 4241
leonardocaylent Apr 6, 2024
05ca35e
Merge remote-tracking branch 'origin/master' into bugfix/group-endpoi…
leonardocaylent Apr 22, 2024
64d0833
Final fix for error on delete
leonardocaylent Apr 22, 2024
5190777
Fix unrelated change on service_test.go address
leonardocaylent Apr 22, 2024
56024fd
Merge remote-tracking branch 'origin/master' into bugfix/group-endpoi…
leonardocaylent Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion provider/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ func sortChangesByActionNameType(cs Route53Changes) Route53Changes {
// changesByZone separates a multi-zone change into a single change per zone.
func changesByZone(zones map[string]*route53.HostedZone, changeSet Route53Changes) map[string]Route53Changes {
changes := make(map[string]Route53Changes)
visitedHostnames := make(map[string]map[string]bool)

for _, z := range zones {
changes[aws.StringValue(z.Id)] = Route53Changes{}
Expand All @@ -993,6 +994,18 @@ func changesByZone(zones map[string]*route53.HostedZone, changeSet Route53Change
continue
}
for _, z := range zones {
log.Debugf("Creating key for %s to zone %s with type %s", hostname, aws.StringValue(z.Id), *c.ResourceRecordSet.Type)
key := fmt.Sprintf("%s_%s", hostname, *c.ResourceRecordSet.Type)
log.Debugf("Key Output: %s", key)
// Initialize the map for the current zone if it doesn't exist
if visitedHostnames[aws.StringValue(z.Id)] == nil {
visitedHostnames[aws.StringValue(z.Id)] = make(map[string]bool)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
visitedHostnames[aws.StringValue(z.Id)] = make(map[string]bool)
visitedHostnames[aws.StringValue(z.Id)] = map[string]struct{}{}

}

if visitedHostnames[aws.StringValue(z.Id)][key] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if visitedHostnames[aws.StringValue(z.Id)][key] {
if _, ok := visitedHostnames[aws.StringValue(z.Id)][key]; ok {

log.Debugf("Skipping duplicate %s to zone %s [Id: %s] Type: %s", hostname, aws.StringValue(z.Name), aws.StringValue(z.Id), *c.ResourceRecordSet.Type)
continue
}
if c.ResourceRecordSet.AliasTarget != nil && aws.StringValue(c.ResourceRecordSet.AliasTarget.HostedZoneId) == sameZoneAlias {
// alias record is to be created; target needs to be in the same zone as endpoint
// if it's not, this will fail
Expand All @@ -1008,7 +1021,8 @@ func changesByZone(zones map[string]*route53.HostedZone, changeSet Route53Change
}
}
changes[aws.StringValue(z.Id)] = append(changes[aws.StringValue(z.Id)], c)
log.Debugf("Adding %s to zone %s [Id: %s]", hostname, aws.StringValue(z.Name), aws.StringValue(z.Id))
visitedHostnames[aws.StringValue(z.Id)][key] = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
visitedHostnames[aws.StringValue(z.Id)][key] = true
visitedHostnames[aws.StringValue(z.Id)][key] = struct{}{}

log.Debugf("Adding %s to zone %s [Id: %s] Type: %s", hostname, aws.StringValue(z.Name), aws.StringValue(z.Id), *c.ResourceRecordSet.Type)
}
}

Expand Down
Loading