This moves `domain_filter.go` to the `endpoint` package to make it
possible to filter and exclude record names in
`plan.filterRecordsForPlan()` so it does not have to be implemented in
every single provider.
Because some providers access `DomainFilter.filters` directly it had to
be exported.
The controller will retrieve all the endpoints at the beginning of its
loop. When changes need to be applied, the provider may need to query
the endpoints again. Allow the provider to skip the queries if its data was
cached.
* When using Domain Filters with PowerDNS provider and providing
no domain filter, the provider ignores all zones instead of
including all zones which is the default behaviour
* Added test cases for PartitionZones function of PDNSClient
The Host field of the HTTP request is set incorrectly when passing
the configured server. The underlying HTTP library experts a hostname
to be passed. When passing it a string of the form 'http://pdns.example.com'
this gets converted into 'http:' (stripping everything from the first
slash onward). However setting the Host field in the pdnsClientConfig
object is not needed because the underlying library will then parse the
hostname from the URL.
Fixes#661
Signed-off-by: Bartel Sielski <bartel.sielski@gmail.com>
* Fixed PowerDNS provider bug affecting endpoint conversion to
zone in a particular case
* Added a regressive test case, covered an additional case
PowerDNS provider bug: In the function ConvertEndpointsToZones,
the endpoints are sorted lexicographically increasing
(and by record type in case of match). The zones are sorted by
decreasing order of length. There's a loop through of zones
under which the code loops through endpoints. In the case
the first endpoint does not match with the first zone,
the complete zone won't get populated with any endpoints.
Commit adds:
* Implementation of PowerDNS as a provider
* Tests for said implementation
* github.com/ffledgling/pdns-go, which provides go client bindings for
PowerDNS's HTTP API, as a dependency
* "pdns" as an additional option for the `--provider` flag
* `--pdns-server` and `--pdns-api-key` as additional flags for PowerDNS
specific configuration