Skip to content

Commit bbcb30d

Browse files
authored
fix: ptr search query (#32)
1 parent c92ee6e commit bbcb30d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ To run the provider, you must provide the following Environment Variables:
3131
| INFOBLOX_DEFAULT_TTL | 300 | false |
3232
| INFOBLOX_EXTENSIBLE_ATTRIBUTES_JSON | {} | false |
3333

34+
### INFOBLOX_CREATE_PTR
35+
36+
When infoblox `INFOBLOX_CREATE_PTR` is set to `true`, make shure that `DOMAIN_FILTER` contains the zone for reversed lookup.
37+
38+
```bash
39+
DOMAIN_FILTER="cloud.example, 1.2.3.0/24"
40+
```
3441

3542
**external-dns-infoblox-webhook Environment Variables**:
3643

internal/infoblox/infoblox.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ func (mrb *ExtendedRequestBuilder) BuildRequest(t ibclient.RequestType, obj ibcl
115115
}
116116

117117
// if we are not doing a ZoneAuth query, support the name filter
118-
if !zoneAuthQuery && mrb.nameRegEx != "" {
118+
_, isPTR := obj.(*ibclient.RecordPTR)
119+
if !isPTR && !zoneAuthQuery && mrb.nameRegEx != "" {
119120
query.Set("name~", mrb.nameRegEx)
120121
}
121122

@@ -363,7 +364,7 @@ func (p *Provider) submitChanges(changes []*infobloxChange) error {
363364
}
364365

365366
changesByZone := p.ChangesByZone(zonePointerConverter(zones), changes)
366-
for _, changes := range changesByZone {
367+
for zone, changes := range changesByZone {
367368
for _, change := range changes {
368369
record, err := p.buildRecord(change)
369370
if err != nil {
@@ -374,6 +375,7 @@ func (p *Provider) submitChanges(changes []*infobloxChange) error {
374375
return err
375376
}
376377
logFields["action"] = change.Action
378+
logFields["zone"] = zone
377379
if p.config.DryRun {
378380
log.WithFields(logFields).Info("Dry run: skipping..")
379381
continue
@@ -712,7 +714,7 @@ func (p *Provider) recordSet(ep *endpoint.Endpoint, getObject bool) (recordSet i
712714
obj.Ttl = &ttl
713715
obj.UseTtl = &ptrToBoolTrue
714716
if getObject {
715-
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": *obj.PtrdName})
717+
queryParams := ibclient.NewQueryParams(false, map[string]string{"ptrdname": *obj.PtrdName, "ipv4addr": *obj.Ipv4Addr})
716718
err = p.client.GetObject(obj, "", queryParams, &res)
717719
if err != nil && !isNotFoundError(err) {
718720
return

0 commit comments

Comments
 (0)