Skip to content

Commit

Permalink
fix ipv6 for infoblox (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWeindel authored Jul 21, 2021
1 parent 52b8b64 commit 1bdb0a9
Show file tree
Hide file tree
Showing 283 changed files with 16,753 additions and 12,736 deletions.
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ require (
github.com/go-openapi/strfmt v0.19.5
github.com/gophercloud/gophercloud v0.18.0
github.com/gophercloud/utils v0.0.0-20190527093828-25f1b77b8c03
github.com/infobloxopen/infoblox-go-client v1.1.0
github.com/infobloxopen/infoblox-go-client/v2 v2.0.0
github.com/miekg/dns v1.1.14
github.com/netlify/open-api v1.1.0
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
github.com/onsi/ginkgo v1.15.0
github.com/onsi/gomega v1.10.5
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.7.1
go.uber.org/atomic v1.6.0
Expand All @@ -35,5 +35,3 @@ require (
sigs.k8s.io/controller-tools v0.4.1
sigs.k8s.io/kind v0.10.0
)

replace github.com/infobloxopen/infoblox-go-client => github.com/MartinWeindel/infoblox-go-client v1.1.1-0.20200616154106-b2951ec7a129
24 changes: 16 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/MartinWeindel/infoblox-go-client v1.1.1-0.20200616154106-b2951ec7a129 h1:rS9fu6vUxb20+YRyzJyDDMNprxyLwQE2xxxg8t7hAvM=
github.com/MartinWeindel/infoblox-go-client v1.1.1-0.20200616154106-b2951ec7a129/go.mod h1:CeHdAt8b5RAhO78sRw2XN/UbrcwzXcenzwPewyYG/no=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
Expand Down Expand Up @@ -423,6 +421,8 @@ github.com/imdario/mergo v0.3.10 h1:6q5mVkdH/vYmqngx7kZQTjJ5HRsx+ImorDIEQ+beJgc=
github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/infobloxopen/infoblox-go-client/v2 v2.0.0 h1:SoGI4PkU2zxGU2SCtpZA7rhd2GyNPsVuE1Ydno6B0Y8=
github.com/infobloxopen/infoblox-go-client/v2 v2.0.0/go.mod h1:+lznx4ASBSUZ2i6qwlgyn0v3eKDxBHNU5aRJzghAFbw=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
Expand Down Expand Up @@ -451,7 +451,6 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand All @@ -464,6 +463,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kyoh86/richgo v0.3.3/go.mod h1:S65jllVRxBm59fqIXfCa3cPxQYRT9u9v45EPQVeuoH0=
github.com/kyoh86/xdg v0.0.0-20171007020617-d28e4c5d7b81/go.mod h1:Z5mDqe0fxyxn3W2yTxsBAOQqIrXADQIh02wrTnaRM38=
github.com/magefile/mage v1.10.0 h1:3HiXzCUY12kh9bIuyXShaVe529fJfyqoVM42o/uom2g=
github.com/magefile/mage v1.10.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
Expand Down Expand Up @@ -528,15 +529,17 @@ github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.14.1 h1:jMU0WaQrP0a/YAEq8eJmJKjBoMs+pClEr1vDMlM/Do4=
github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/ginkgo v1.15.0 h1:1V1NfVQR87RtWAgp1lv9JZJ5Jap+XFGKPi00andXGi4=
github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.2 h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs=
github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ=
github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
Expand Down Expand Up @@ -596,8 +599,9 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.8.0 h1:nfhvjKcUMhBMVqbKHJlk5RPrrfYr/NMo3692g0dwfWU=
github.com/sirupsen/logrus v1.8.0/go.mod h1:4GuYW9TZmE769R5STWrRakJc4UqQ3+QQ95fyz7ENv1A=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
Expand Down Expand Up @@ -770,8 +774,10 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -837,8 +843,9 @@ golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200928205150-006507a75852/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091 h1:DMyOG0U+gKfu8JZzg2UQe9MeaC1X+xQWlAKcRnjxjCw=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down Expand Up @@ -909,6 +916,7 @@ golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20200616133436-c1934b75d054/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200616195046-dc31b401abb5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a h1:CB3a9Nez8M13wwlr/E2YtwoU+qYHKfC+JrDa45RXXoQ=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/provider/alicloud/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (this *access) DeleteRecord(r raw.Record, zone provider.DNSHostedZone) erro
return err
}

func (this *access) NewRecord(fqdn, rtype, value string, zone provider.DNSHostedZone, ttl int64) (raw.Record, error) {
func (this *access) NewRecord(fqdn, rtype, value string, zone provider.DNSHostedZone, ttl int64) raw.Record {
rr := GetRR(fqdn, zone.Domain())
return (*Record)(&alidns.Record{RR: rr, Type: rtype, Value: value, DomainName: zone.Domain(), TTL: int(ttl)}), nil
return (*Record)(&alidns.Record{RR: rr, Type: rtype, Value: value, DomainName: zone.Domain(), TTL: int(ttl)})
}
4 changes: 2 additions & 2 deletions pkg/controller/provider/cloudflare/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ func (this *access) DeleteRecord(r raw.Record, zone provider.DNSHostedZone) erro
return err
}

func (this *access) NewRecord(fqdn, rtype, value string, zone provider.DNSHostedZone, ttl int64) (raw.Record, error) {
func (this *access) NewRecord(fqdn, rtype, value string, zone provider.DNSHostedZone, ttl int64) raw.Record {
return (*Record)(&cloudflare.DNSRecord{
Type: rtype,
Name: fqdn,
Content: value,
TTL: int(ttl),
ZoneID: zone.Id(),
}), nil
})
}

func testTTL(ttl *int) {
Expand Down
34 changes: 17 additions & 17 deletions pkg/controller/provider/infoblox/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
package infoblox

import (
"fmt"
"strconv"
"strings"

ibclient "github.com/infobloxopen/infoblox-go-client"
ibclient "github.com/infobloxopen/infoblox-go-client/v2"

"github.com/gardener/external-dns-management/pkg/dns"
"github.com/gardener/external-dns-management/pkg/dns/provider"
Expand Down Expand Up @@ -63,32 +62,33 @@ func (this *access) DeleteRecord(r raw.Record, zone provider.DNSHostedZone) erro
return err
}

func (this *access) NewRecord(fqdn string, rtype string, value string, zone provider.DNSHostedZone, ttl int64) (record raw.Record, err error) {
func (this *access) NewRecord(fqdn string, rtype string, value string, zone provider.DNSHostedZone, ttl int64) (record raw.Record) {
switch rtype {
case dns.RS_A:
record = (*RecordA)(ibclient.NewRecordA(ibclient.RecordA{
Name: fqdn,
Ipv4Addr: value,
//Zone: zone.Key(),
View: this.view,
}))
r := ibclient.NewEmptyRecordA()
r.Name = fqdn
r.Ipv4Addr = value
r.View = this.view
record = (*RecordA)(r)
case dns.RS_AAAA:
err = fmt.Errorf("warning: aaaa records not supported on infoblox yet")
r := ibclient.NewEmptyRecordAAAA()
r.Name = fqdn
r.Ipv6Addr = value
r.View = this.view
record = (*RecordAAAA)(r)
case dns.RS_CNAME:
record = (*RecordCNAME)(ibclient.NewRecordCNAME(ibclient.RecordCNAME{
Name: fqdn,
Canonical: value,
//Zone: zone.Key(),
View: this.view,
}))
r := ibclient.NewEmptyRecordCNAME()
r.Name = fqdn
r.Canonical = value
r.View = this.view
record = (*RecordCNAME)(r)
case dns.RS_TXT:
if n, err := strconv.Unquote(value); err == nil && !strings.Contains(value, " ") {
value = n
}
record = (*RecordTXT)(ibclient.NewRecordTXT(ibclient.RecordTXT{
Name: fqdn,
Text: value,
//Zone: zone.Key(),
View: this.view,
}))
}
Expand Down
49 changes: 28 additions & 21 deletions pkg/controller/provider/infoblox/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/gardener/external-dns-management/pkg/dns/provider"
"github.com/gardener/external-dns-management/pkg/dns/provider/raw"

ibclient "github.com/infobloxopen/infoblox-go-client"
ibclient "github.com/infobloxopen/infoblox-go-client/v2"
)

type Handler struct {
Expand Down Expand Up @@ -183,7 +183,7 @@ func (h *Handler) getZones(cache provider.ZoneCache) (provider.DNSHostedZones, e
var raw []ibclient.ZoneAuth
h.config.Metrics.AddGenericRequests(provider.M_LISTZONES, 1)
obj := ibclient.NewZoneAuth(ibclient.ZoneAuth{})
err := h.access.GetObject(obj, "", &raw)
err := h.access.GetObject(obj, "", &ibclient.QueryParams{}, &raw)
if err != nil {
return nil, err
}
Expand All @@ -198,7 +198,7 @@ func (h *Handler) getZones(cache provider.ZoneCache) (provider.DNSHostedZones, e
View: *h.infobloxConfig.View,
},
)
err = h.access.GetObject(objN, "", &resN)
err = h.access.GetObject(objN, "", &ibclient.QueryParams{}, &resN)
if err != nil {
return nil, fmt.Errorf("could not fetch NS records from zone '%s': %s", z.Fqdn, err)
}
Expand All @@ -220,34 +220,41 @@ func (h *Handler) getZoneState(zone provider.DNSHostedZone, cache provider.ZoneC

h.config.Metrics.AddZoneRequests(zone.Id(), rt, 1)
var resA []RecordA
objA := ibclient.NewRecordA(
ibclient.RecordA{
Zone: zone.Key(),
View: *h.infobloxConfig.View,
},
)
err := h.access.GetObject(objA, "", &resA)
objA := ibclient.NewEmptyRecordA()
objA.Zone = zone.Key()
objA.View = *h.infobloxConfig.View
err := h.access.GetObject(objA, "", &ibclient.QueryParams{}, &resA)
if err != nil {
return nil, fmt.Errorf("could not fetch A records from zone '%s': %s", zone.Key(), err)
}
for _, res := range resA {
state.AddRecord((*RecordA)(&res).Copy())
state.AddRecord((&res).Copy())
}

h.config.Metrics.AddZoneRequests(zone.Id(), rt, 1)
var resAAAA []RecordAAAA
objAAAA := ibclient.NewEmptyRecordAAAA()
objAAAA.Zone = zone.Key()
objAAAA.View = *h.infobloxConfig.View
err = h.access.GetObject(objAAAA, "", &ibclient.QueryParams{}, &resAAAA)
if err != nil {
return nil, fmt.Errorf("could not fetch AAAA records from zone '%s': %s", zone.Key(), err)
}
for _, res := range resAAAA {
state.AddRecord((&res).Copy())
}

h.config.Metrics.AddZoneRequests(zone.Id(), rt, 1)
var resC []RecordCNAME
objC := ibclient.NewRecordCNAME(
ibclient.RecordCNAME{
Zone: zone.Key(),
View: *h.infobloxConfig.View,
},
)
err = h.access.GetObject(objC, "", &resC)
objC := ibclient.NewEmptyRecordCNAME()
objC.Zone = zone.Key()
objC.View = *h.infobloxConfig.View
err = h.access.GetObject(objC, "", &ibclient.QueryParams{}, &resC)
if err != nil {
return nil, fmt.Errorf("could not fetch CNAME records from zone '%s': %s", zone.Key(), err)
}
for _, res := range resC {
state.AddRecord((*RecordCNAME)(&res).Copy())
state.AddRecord((&res).Copy())
}

h.config.Metrics.AddZoneRequests(zone.Id(), rt, 1)
Expand All @@ -258,12 +265,12 @@ func (h *Handler) getZoneState(zone provider.DNSHostedZone, cache provider.ZoneC
View: *h.infobloxConfig.View,
},
)
err = h.access.GetObject(objT, "", &resT)
err = h.access.GetObject(objT, "", &ibclient.QueryParams{}, &resT)
if err != nil {
return nil, fmt.Errorf("could not fetch TXT records from zone '%s': %s", zone.Key(), err)
}
for _, res := range resT {
state.AddRecord((*RecordTXT)(&res).Copy())
state.AddRecord((&res).Copy())
}

state.CalculateDNSSets()
Expand Down
26 changes: 21 additions & 5 deletions pkg/controller/provider/infoblox/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package infoblox

import (
ibclient "github.com/infobloxopen/infoblox-go-client"
ibclient "github.com/infobloxopen/infoblox-go-client/v2"

"github.com/gardener/external-dns-management/pkg/dns"
"github.com/gardener/external-dns-management/pkg/dns/provider/raw"
Expand All @@ -36,13 +36,29 @@ func (r *RecordA) GetId() string { return r.Ref }
func (r *RecordA) GetDNSName() string { return r.Name }
func (r *RecordA) GetValue() string { return r.Ipv4Addr }
func (r *RecordA) GetTTL() int { return int(r.Ttl) }
func (r *RecordA) SetTTL(ttl int) { r.Ttl = uint(ttl); r.UseTtl = ttl != 0 }
func (r *RecordA) SetTTL(ttl int) { r.Ttl = uint32(ttl); r.UseTtl = ttl != 0 }
func (r *RecordA) Copy() raw.Record { n := *r; return &n }
func (r *RecordA) PrepareUpdate() raw.Record {
n := *r
n.Zone = ""
n.CreationTime = 0
n.DnsName = ""
n.Name = ""
n.View = ""
return &n
}

type RecordAAAA ibclient.RecordAAAA

func (r *RecordAAAA) GetType() string { return dns.RS_A }
func (r *RecordAAAA) GetId() string { return r.Ref }
func (r *RecordAAAA) GetDNSName() string { return r.Name }
func (r *RecordAAAA) GetValue() string { return r.Ipv6Addr }
func (r *RecordAAAA) GetTTL() int { return int(r.Ttl) }
func (r *RecordAAAA) SetTTL(ttl int) { r.Ttl = uint32(ttl); r.UseTtl = ttl != 0 }
func (r *RecordAAAA) Copy() raw.Record { n := *r; return &n }
func (r *RecordAAAA) PrepareUpdate() raw.Record {
n := *r
n.Zone = ""
n.Name = ""
n.View = ""
return &n
}
Expand All @@ -54,7 +70,7 @@ func (r *RecordCNAME) GetId() string { return r.Ref }
func (r *RecordCNAME) GetDNSName() string { return r.Name }
func (r *RecordCNAME) GetValue() string { return r.Canonical }
func (r *RecordCNAME) GetTTL() int { return int(r.Ttl) }
func (r *RecordCNAME) SetTTL(ttl int) { r.Ttl = uint(ttl); r.UseTtl = ttl != 0 }
func (r *RecordCNAME) SetTTL(ttl int) { r.Ttl = uint32(ttl); r.UseTtl = ttl != 0 }
func (r *RecordCNAME) Copy() raw.Record { n := *r; return &n }
func (r *RecordCNAME) PrepareUpdate() raw.Record { n := *r; n.Zone = ""; n.View = ""; return &n }

Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/provider/infoblox/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"net/http"
"strconv"

ibclient "github.com/infobloxopen/infoblox-go-client"
ibclient "github.com/infobloxopen/infoblox-go-client/v2"
)

// MaxResultsRequestBuilder implements a HttpRequestBuilder which sets the
Expand All @@ -42,7 +42,7 @@ func NewMaxResultsRequestBuilder(maxResults int, requestBuilder ibclient.HttpReq

// BuildRequest prepares the api request. it uses BuildRequest of
// WapiRequestBuilder and then add the _max_requests parameter
func (mrb *MaxResultsRequestBuilder) BuildRequest(t ibclient.RequestType, obj ibclient.IBObject, ref string, queryParams ibclient.QueryParams) (req *http.Request, err error) {
func (mrb *MaxResultsRequestBuilder) BuildRequest(t ibclient.RequestType, obj ibclient.IBObject, ref string, queryParams *ibclient.QueryParams) (req *http.Request, err error) {
req, err = mrb.HttpRequestBuilder.BuildRequest(t, obj, ref, queryParams)
if req.Method == "GET" {
query := req.URL.Query()
Expand Down
Loading

0 comments on commit 1bdb0a9

Please sign in to comment.