mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-07 01:56:57 +02:00
Merge pull request #2502 from BobVanB/better_logging_for_debug
[Infoblox] Granular level of logging
This commit is contained in:
commit
d521d5d770
@ -219,6 +219,8 @@ func (p *InfobloxProvider) Records(ctx context.Context) (endpoints []*endpoint.E
|
|||||||
}
|
}
|
||||||
for _, res := range resH {
|
for _, res := range resH {
|
||||||
for _, ip := range res.Ipv4Addrs {
|
for _, ip := range res.Ipv4Addrs {
|
||||||
|
logrus.Debugf("Record='%s' A(H):'%s'", res.Name, ip.Ipv4Addr)
|
||||||
|
|
||||||
// host record is an abstraction in infoblox that combines A and PTR records
|
// host record is an abstraction in infoblox that combines A and PTR records
|
||||||
// for any host record we already should have a PTR record in infoblox, so mark it as created
|
// for any host record we already should have a PTR record in infoblox, so mark it as created
|
||||||
newEndpoint := endpoint.NewEndpoint(res.Name, endpoint.RecordTypeA, ip.Ipv4Addr)
|
newEndpoint := endpoint.NewEndpoint(res.Name, endpoint.RecordTypeA, ip.Ipv4Addr)
|
||||||
@ -241,6 +243,7 @@ func (p *InfobloxProvider) Records(ctx context.Context) (endpoints []*endpoint.E
|
|||||||
return nil, fmt.Errorf("could not fetch CNAME records from zone '%s': %s", zone.Fqdn, err)
|
return nil, fmt.Errorf("could not fetch CNAME records from zone '%s': %s", zone.Fqdn, err)
|
||||||
}
|
}
|
||||||
for _, res := range resC {
|
for _, res := range resC {
|
||||||
|
logrus.Debugf("Record='%s' CNAME:'%s'", res.Name, res.Canonical)
|
||||||
endpoints = append(endpoints, endpoint.NewEndpoint(res.Name, endpoint.RecordTypeCNAME, res.Canonical))
|
endpoints = append(endpoints, endpoint.NewEndpoint(res.Name, endpoint.RecordTypeCNAME, res.Canonical))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +287,8 @@ func (p *InfobloxProvider) Records(ctx context.Context) (endpoints []*endpoint.E
|
|||||||
if _, err := strconv.Unquote(res.Text); err != nil {
|
if _, err := strconv.Unquote(res.Text); err != nil {
|
||||||
res.Text = strconv.Quote(res.Text)
|
res.Text = strconv.Quote(res.Text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logrus.Debugf("Record='%s' TXT:'%s'", res.Name, res.Text)
|
||||||
endpoints = append(endpoints, endpoint.NewEndpoint(res.Name, endpoint.RecordTypeTXT, res.Text))
|
endpoints = append(endpoints, endpoint.NewEndpoint(res.Name, endpoint.RecordTypeTXT, res.Text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -567,12 +572,14 @@ func (p *InfobloxProvider) recordSet(ep *endpoint.Endpoint, getObject bool, targ
|
|||||||
func (p *InfobloxProvider) createRecords(created infobloxChangeMap) {
|
func (p *InfobloxProvider) createRecords(created infobloxChangeMap) {
|
||||||
for zone, endpoints := range created {
|
for zone, endpoints := range created {
|
||||||
for _, ep := range endpoints {
|
for _, ep := range endpoints {
|
||||||
|
for targetIndex := range ep.Targets {
|
||||||
if p.dryRun {
|
if p.dryRun {
|
||||||
logrus.Infof(
|
logrus.Infof(
|
||||||
|
|
||||||
"Would create %s record named '%s' to '%s' for Infoblox DNS zone '%s'.",
|
"Would create %s record named '%s' to '%s' for Infoblox DNS zone '%s'.",
|
||||||
ep.RecordType,
|
ep.RecordType,
|
||||||
ep.DNSName,
|
ep.DNSName,
|
||||||
ep.Targets,
|
ep.Targets[targetIndex],
|
||||||
zone,
|
zone,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
@ -582,11 +589,10 @@ func (p *InfobloxProvider) createRecords(created infobloxChangeMap) {
|
|||||||
"Creating %s record named '%s' to '%s' for Infoblox DNS zone '%s'.",
|
"Creating %s record named '%s' to '%s' for Infoblox DNS zone '%s'.",
|
||||||
ep.RecordType,
|
ep.RecordType,
|
||||||
ep.DNSName,
|
ep.DNSName,
|
||||||
ep.Targets,
|
ep.Targets[targetIndex],
|
||||||
zone,
|
zone,
|
||||||
)
|
)
|
||||||
|
|
||||||
for targetIndex := range ep.Targets {
|
|
||||||
recordSet, err := p.recordSet(ep, false, targetIndex)
|
recordSet, err := p.recordSet(ep, false, targetIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf(
|
logrus.Errorf(
|
||||||
@ -619,10 +625,6 @@ func (p *InfobloxProvider) deleteRecords(deleted infobloxChangeMap) {
|
|||||||
// Delete records first
|
// Delete records first
|
||||||
for zone, endpoints := range deleted {
|
for zone, endpoints := range deleted {
|
||||||
for _, ep := range endpoints {
|
for _, ep := range endpoints {
|
||||||
if p.dryRun {
|
|
||||||
logrus.Infof("Would delete %s record named '%s' for Infoblox DNS zone '%s'.", ep.RecordType, ep.DNSName, zone)
|
|
||||||
} else {
|
|
||||||
logrus.Infof("Deleting %s record named '%s' for Infoblox DNS zone '%s'.", ep.RecordType, ep.DNSName, zone)
|
|
||||||
for targetIndex := range ep.Targets {
|
for targetIndex := range ep.Targets {
|
||||||
recordSet, err := p.recordSet(ep, true, targetIndex)
|
recordSet, err := p.recordSet(ep, true, targetIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -639,26 +641,47 @@ func (p *InfobloxProvider) deleteRecords(deleted infobloxChangeMap) {
|
|||||||
switch ep.RecordType {
|
switch ep.RecordType {
|
||||||
case endpoint.RecordTypeA:
|
case endpoint.RecordTypeA:
|
||||||
for _, record := range *recordSet.res.(*[]ibclient.RecordA) {
|
for _, record := range *recordSet.res.(*[]ibclient.RecordA) {
|
||||||
|
if p.dryRun {
|
||||||
|
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "A", record.Name, record.Ipv4Addr, record.Zone)
|
||||||
|
} else {
|
||||||
|
logrus.Debugf("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "A", record.Name, record.Ipv4Addr, record.Zone)
|
||||||
_, err = p.client.DeleteObject(record.Ref)
|
_, err = p.client.DeleteObject(record.Ref)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case endpoint.RecordTypePTR:
|
case endpoint.RecordTypePTR:
|
||||||
for _, record := range *recordSet.res.(*[]ibclient.RecordPTR) {
|
for _, record := range *recordSet.res.(*[]ibclient.RecordPTR) {
|
||||||
|
if p.dryRun {
|
||||||
|
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "PTR", record.PtrdName, record.Ipv4Addr, record.Zone)
|
||||||
|
} else {
|
||||||
|
logrus.Debugf("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "PTR", record.PtrdName, record.Ipv4Addr, record.Zone)
|
||||||
_, err = p.client.DeleteObject(record.Ref)
|
_, err = p.client.DeleteObject(record.Ref)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case endpoint.RecordTypeCNAME:
|
case endpoint.RecordTypeCNAME:
|
||||||
for _, record := range *recordSet.res.(*[]ibclient.RecordCNAME) {
|
for _, record := range *recordSet.res.(*[]ibclient.RecordCNAME) {
|
||||||
|
if p.dryRun {
|
||||||
|
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "CNAME", record.Name, record.Canonical, record.Zone)
|
||||||
|
} else {
|
||||||
|
logrus.Debugf("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "CNAME", record.Name, record.Canonical, record.Zone)
|
||||||
_, err = p.client.DeleteObject(record.Ref)
|
_, err = p.client.DeleteObject(record.Ref)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case endpoint.RecordTypeTXT:
|
case endpoint.RecordTypeTXT:
|
||||||
for _, record := range *recordSet.res.(*[]ibclient.RecordTXT) {
|
for _, record := range *recordSet.res.(*[]ibclient.RecordTXT) {
|
||||||
|
if p.dryRun {
|
||||||
|
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "TXT", record.Name, record.Text, record.Zone)
|
||||||
|
} else {
|
||||||
|
logrus.Debugf("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "TXT", record.Name, record.Text, record.Zone)
|
||||||
_, err = p.client.DeleteObject(record.Ref)
|
_, err = p.client.DeleteObject(record.Ref)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf(
|
logrus.Errorf(
|
||||||
"Failed to delete %s record named '%s' for Infoblox DNS zone '%s': %v",
|
"Failed to delete %s record named '%s' to '%s' for Infoblox DNS zone '%s': %v",
|
||||||
ep.RecordType,
|
ep.RecordType,
|
||||||
ep.DNSName,
|
ep.DNSName,
|
||||||
|
ep.Targets[targetIndex],
|
||||||
zone,
|
zone,
|
||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
@ -666,7 +689,6 @@ func (p *InfobloxProvider) deleteRecords(deleted infobloxChangeMap) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func lookupEnvAtoi(key string, fallback int) (i int) {
|
func lookupEnvAtoi(key string, fallback int) (i int) {
|
||||||
|
Loading…
Reference in New Issue
Block a user