mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 17:46:57 +02:00
move the logging to registry (#157)
This commit is contained in:
parent
afa4cff158
commit
cbf54d904c
@ -63,16 +63,6 @@ func (c *Controller) RunOnce() error {
|
||||
|
||||
plan = plan.Calculate()
|
||||
|
||||
for _, change := range plan.Changes.Create {
|
||||
log.Infof("Creating %s %s -> %s ..", change.RecordType, change.DNSName, change.Target)
|
||||
}
|
||||
for _, change := range plan.Changes.UpdateNew {
|
||||
log.Infof("Updating %s %s -> %s ..", change.RecordType, change.DNSName, change.Target)
|
||||
}
|
||||
for _, change := range plan.Changes.Delete {
|
||||
log.Infof("Deleting %s %s -> %s ..", change.RecordType, change.DNSName, change.Target)
|
||||
}
|
||||
|
||||
return c.Registry.ApplyChanges(c.Zone, plan.Changes)
|
||||
}
|
||||
|
||||
|
@ -41,5 +41,6 @@ func (im *NoopRegistry) Records(zone string) ([]*endpoint.Endpoint, error) {
|
||||
|
||||
// ApplyChanges propagates changes to the dns provider
|
||||
func (im *NoopRegistry) ApplyChanges(zone string, changes *plan.Changes) error {
|
||||
logChanges(changes)
|
||||
return im.provider.ApplyChanges(zone, changes)
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
package registry
|
||||
|
||||
import (
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/kubernetes-incubator/external-dns/endpoint"
|
||||
"github.com/kubernetes-incubator/external-dns/plan"
|
||||
)
|
||||
@ -40,3 +41,15 @@ func filterOwnedRecords(ownerID string, eps []*endpoint.Endpoint) []*endpoint.En
|
||||
}
|
||||
return filtered
|
||||
}
|
||||
|
||||
func logChanges(changes *plan.Changes) {
|
||||
for _, change := range changes.Create {
|
||||
log.Infof("Creating %s %s -> %s ..", change.RecordType, change.DNSName, change.Target)
|
||||
}
|
||||
for _, change := range changes.UpdateNew {
|
||||
log.Infof("Updating %s %s -> %s ..", change.RecordType, change.DNSName, change.Target)
|
||||
}
|
||||
for _, change := range changes.Delete {
|
||||
log.Infof("Deleting %s %s -> %s ..", change.RecordType, change.DNSName, change.Target)
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ func (im *TXTRegistry) ApplyChanges(zone string, changes *plan.Changes) error {
|
||||
txt := endpoint.NewEndpoint(im.mapper.toTXTName(r.DNSName), im.getTXTLabel(), "TXT")
|
||||
filteredChanges.Delete = append(filteredChanges.Delete, txt)
|
||||
}
|
||||
|
||||
logChanges(filteredChanges)
|
||||
return im.provider.ApplyChanges(zone, filteredChanges)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user