Skip to content

Commit

Permalink
fix: ptr search query
Browse files Browse the repository at this point in the history
  • Loading branch information
BobVanB committed Dec 25, 2024
1 parent c92ee6e commit 1a47f1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**:

Expand Down
8 changes: 5 additions & 3 deletions internal/infoblox/infoblox.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1a47f1b

Please sign in to comment.