mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 01:26:59 +02:00
fix: linter
This commit is contained in:
parent
2333e93f1e
commit
80058873e4
10
plan/plan.go
10
plan/plan.go
@ -87,13 +87,13 @@ func (changes *Changes) MarshalJSON() ([]byte, error) {
|
||||
})
|
||||
}
|
||||
|
||||
func MkUpdates(old []*endpoint.Endpoint, new []*endpoint.Endpoint) ([]*Update, error) {
|
||||
func MkUpdates(olds []*endpoint.Endpoint, news []*endpoint.Endpoint) ([]*Update, error) {
|
||||
updates := []*Update{}
|
||||
if nOld, nNew := len(old), len(new); nOld != nNew {
|
||||
return nil, fmt.Errorf("Number of old updates (%v) does not match number of new updates (%v)", nOld, nNew)
|
||||
if nOld, nNew := len(olds), len(news); nOld != nNew {
|
||||
return nil, fmt.Errorf("number of old updates (%v) does not match number of new updates (%v)", nOld, nNew)
|
||||
}
|
||||
for i, old := range old {
|
||||
updates = append(updates, &Update{Old: old, New: new[i]})
|
||||
for i, old := range olds {
|
||||
updates = append(updates, &Update{Old: old, New: news[i]})
|
||||
}
|
||||
return updates, nil
|
||||
}
|
||||
|
@ -304,7 +304,6 @@ func (f *zoneFilter) EndpointZoneID(endpoint *endpoint.Endpoint, zones map[strin
|
||||
func merge(updates []*plan.Update) []*endpoint.Endpoint {
|
||||
var result []*endpoint.Endpoint
|
||||
for _, update := range updates {
|
||||
|
||||
if !update.New.Targets.Same(update.Old.Targets) {
|
||||
// new target: always update, TTL will be overwritten too if necessary
|
||||
result = append(result, update.New)
|
||||
|
@ -284,8 +284,8 @@ func (im *TXTRegistry) ApplyChanges(ctx context.Context, changes *plan.Changes)
|
||||
// when we update old TXT records for which value has changed (due to new label) this would still work because
|
||||
// !!! TXT record value is uniquely generated from the Labels of the endpoint. Hence old TXT record can be uniquely reconstructed
|
||||
// NOTE: Whether `generateTXTRecord` returns `nil` depends only on DNSName, which will be the same for `old` and `new`
|
||||
if old, new := im.generateTXTRecord(r.Old), im.generateTXTRecord(r.New); old != nil && new != nil {
|
||||
filteredChanges.Update = append(filteredChanges.Update, &plan.Update{Old: old, New: new})
|
||||
if old, new_ := im.generateTXTRecord(r.Old), im.generateTXTRecord(r.New); old != nil && new_ != nil {
|
||||
filteredChanges.Update = append(filteredChanges.Update, &plan.Update{Old: old, New: new_})
|
||||
}
|
||||
if im.cacheInterval > 0 {
|
||||
// remove old version of record from cache
|
||||
|
Loading…
Reference in New Issue
Block a user