mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 01:26:59 +02:00
minor improvements to logging (#175)
* minor improvements to logging * chore(*): change log.Infoln to log.Info * fix: fix incorrect example code
This commit is contained in:
parent
d4a396b667
commit
82a172a9f9
@ -77,7 +77,7 @@ func (c *Controller) Run(stopChan <-chan struct{}) {
|
||||
select {
|
||||
case <-time.After(c.Interval):
|
||||
case <-stopChan:
|
||||
log.Infoln("Terminating main controller loop")
|
||||
log.Info("Terminating main controller loop")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -58,5 +58,5 @@ func (e *Endpoint) MergeLabels(labels map[string]string) {
|
||||
}
|
||||
|
||||
func (e *Endpoint) String() string {
|
||||
return fmt.Sprintf("%s: %s -> %s", e.RecordType, e.DNSName, e.Target)
|
||||
return fmt.Sprintf(`%s -> %s (type "%s")`, e.DNSName, e.Target, e.RecordType)
|
||||
}
|
||||
|
@ -55,9 +55,9 @@ func ExampleSameEndpoints() {
|
||||
fmt.Println(ep)
|
||||
}
|
||||
// Output:
|
||||
// A: abc.com -> 1.2.3.4
|
||||
// TXT: abc.com -> something
|
||||
// CNAME: bbc.com -> foo.com
|
||||
// : example.org -> load-balancer.org
|
||||
// TXT: example.org -> load-balancer.org
|
||||
// abc.com -> 1.2.3.4 (type "A")
|
||||
// abc.com -> something (type "TXT")
|
||||
// bbc.com -> foo.com (type "CNAME")
|
||||
// example.org -> load-balancer.org (type "")
|
||||
// example.org -> load-balancer.org (type "TXT")
|
||||
}
|
||||
|
4
main.go
4
main.go
@ -153,7 +153,7 @@ func main() {
|
||||
|
||||
ctrl.Run(stopChan)
|
||||
for {
|
||||
log.Infoln("pod waiting to be deleted")
|
||||
log.Info("Pod waiting to be deleted")
|
||||
time.Sleep(time.Second * 30)
|
||||
}
|
||||
}
|
||||
@ -162,7 +162,7 @@ func handleSigterm(stopChan chan struct{}) {
|
||||
signals := make(chan os.Signal, 1)
|
||||
signal.Notify(signals, syscall.SIGTERM)
|
||||
<-signals
|
||||
log.Infoln("received SIGTERM. Terminating...")
|
||||
log.Info("Received SIGTERM. Terminating...")
|
||||
close(stopChan)
|
||||
}
|
||||
|
||||
|
@ -188,6 +188,7 @@ func (p *AWSProvider) ApplyChanges(_ string, changes *plan.Changes) error {
|
||||
func (p *AWSProvider) submitChanges(changes []*route53.Change) error {
|
||||
// return early if there is nothing to change
|
||||
if len(changes) == 0 {
|
||||
log.Info("All records are already up to date")
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -201,7 +202,7 @@ func (p *AWSProvider) submitChanges(changes []*route53.Change) error {
|
||||
|
||||
for z, cs := range changesByZone {
|
||||
for _, c := range cs {
|
||||
log.Infof("Changing records: %s %s", aws.StringValue(c.Action), c.String())
|
||||
log.Infof("Changing records: %s %s ...", aws.StringValue(c.Action), c.String())
|
||||
}
|
||||
if !p.DryRun {
|
||||
params := &route53.ChangeResourceRecordSetsInput{
|
||||
@ -212,8 +213,10 @@ func (p *AWSProvider) submitChanges(changes []*route53.Change) error {
|
||||
}
|
||||
|
||||
if _, err := p.Client.ChangeResourceRecordSets(params); err != nil {
|
||||
log.Error(err)
|
||||
log.Error(err) //TODO(ideahitme): consider changing the interface in cases when this error might be a concern for other components
|
||||
continue
|
||||
}
|
||||
log.Infof("Record in zone %s were successfully updated", aws.StringValue(zones[z].Name))
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,7 +245,6 @@ func changesByZone(zones map[string]*route53.HostedZone, changeSet []*route53.Ch
|
||||
// separating a change could lead to empty sub changes, remove them here.
|
||||
for zone, change := range changes {
|
||||
if len(change) == 0 {
|
||||
log.Infof("No records to be changed in zone: %s", aws.StringValue(zones[zone].Name))
|
||||
delete(changes, zone)
|
||||
}
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ func (p *googleProvider) ApplyChanges(_ string, changes *plan.Changes) error {
|
||||
// submitChange takes a zone and a Change and sends it to Google.
|
||||
func (p *googleProvider) submitChange(change *dns.Change) error {
|
||||
if len(change.Additions) == 0 && len(change.Deletions) == 0 {
|
||||
log.Infoln("Received empty list of records for creation and deletion")
|
||||
log.Info("All records are already up to date")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ func filterOwnedRecords(ownerID string, eps []*endpoint.Endpoint) []*endpoint.En
|
||||
filtered := []*endpoint.Endpoint{}
|
||||
for _, ep := range eps {
|
||||
if endpointOwner, ok := ep.Labels[endpoint.OwnerLabelKey]; !ok || endpointOwner != ownerID {
|
||||
log.Debugf("Skipping endpoint %v because owner id does not match, found: %s, required: %s", ep, endpointOwner, ownerID)
|
||||
log.Debugf(`Skipping endpoint %v because owner id does not match, found: "%s", required: "%s"`, ep, endpointOwner, ownerID)
|
||||
continue
|
||||
}
|
||||
filtered = append(filtered, ep)
|
||||
|
Loading…
Reference in New Issue
Block a user