Skip to content

Commit

Permalink
Merge 5e25d82 into b0a3f37
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasv314 committed Feb 12, 2020
2 parents b0a3f37 + 5e25d82 commit ade1c81
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion source/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,20 @@ func (sc *serviceSource) extractHeadlessEndpoints(svc *v1.Service, hostname stri
}
sort.Strings(headlessDomains)
for _, headlessDomain := range headlessDomains {
targets := targetsByHeadlessDomain[headlessDomain]
allTargets := targetsByHeadlessDomain[headlessDomain]
targets := []string{}

deduppedTargets := map[string]bool{}
for _, target := range allTargets {
if _, ok := deduppedTargets[target]; ok {
log.Debugf("Removing duplicate target %s", target)
continue
}

deduppedTargets[target] = true
targets = append(targets, target)
}

if ttl.IsConfigured() {
endpoints = append(endpoints, endpoint.NewEndpointWithTTL(headlessDomain, endpoint.RecordTypeA, ttl, targets...))
} else {
Expand Down

0 comments on commit ade1c81

Please sign in to comment.