diff --git a/README.md b/README.md index d6d370d..85a4705 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,13 @@ To run the provider, you must provide the following Environment Variables: | INFOBLOX_DEFAULT_TTL | 300 | false | | INFOBLOX_EXTENSIBLE_ATTRIBUTES_JSON | {} | false | +### INFOBLOX_CREATE_PTR + +When infoblox `INFOBLOX_CREATE_PTR` is set to `true`, make shure that `DOMAIN_FILTER` contains the zone for reversed lookup. + +```bash +DOMAIN_FILTER="cloud.example, 1.2.3.0/24" +``` **external-dns-infoblox-webhook Environment Variables**: diff --git a/internal/infoblox/infoblox.go b/internal/infoblox/infoblox.go index b150fe8..b991dae 100644 --- a/internal/infoblox/infoblox.go +++ b/internal/infoblox/infoblox.go @@ -115,7 +115,8 @@ func (mrb *ExtendedRequestBuilder) BuildRequest(t ibclient.RequestType, obj ibcl } // if we are not doing a ZoneAuth query, support the name filter - if !zoneAuthQuery && mrb.nameRegEx != "" { + _, isPTR := obj.(*ibclient.RecordPTR) + if !isPTR && !zoneAuthQuery && mrb.nameRegEx != "" { query.Set("name~", mrb.nameRegEx) } @@ -363,7 +364,7 @@ func (p *Provider) submitChanges(changes []*infobloxChange) error { } changesByZone := p.ChangesByZone(zonePointerConverter(zones), changes) - for _, changes := range changesByZone { + for zone, changes := range changesByZone { for _, change := range changes { record, err := p.buildRecord(change) if err != nil { @@ -374,6 +375,7 @@ func (p *Provider) submitChanges(changes []*infobloxChange) error { return err } logFields["action"] = change.Action + logFields["zone"] = zone if p.config.DryRun { log.WithFields(logFields).Info("Dry run: skipping..") continue @@ -712,7 +714,7 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i obj.Ttl = &ttl obj.UseTtl = &ptrToBoolTrue if getObject { - queryParams := ibclient.NewQueryParams(false, map[string]string{"name": *obj.PtrdName}) + queryParams := ibclient.NewQueryParams(false, map[string]string{"ptrdname": *obj.PtrdName, "ipv4addr": *obj.Ipv4Addr}) err = p.client.GetObject(obj, "", queryParams, &res) if err != nil && !isNotFoundError(err) { return