Skip to content

refactor(pdns): replace unmaintained ffledgling/pdns-go with joeig/go-powerdns/v3#6486

Open
mloiseleur wants to merge 2 commits into
kubernetes-sigs:masterfrom
mloiseleur:fix/pdns
Open

refactor(pdns): replace unmaintained ffledgling/pdns-go with joeig/go-powerdns/v3#6486
mloiseleur wants to merge 2 commits into
kubernetes-sigs:masterfrom
mloiseleur:fix/pdns

Conversation

@mloiseleur

@mloiseleur mloiseleur commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Motivation

The PowerDNS provider depends on github.com/ffledgling/pdns-go, a swagger-generated client pinned to a 2018 commit of a personal fork — idle since 2019, zero releases. This PR replaces it with joeig/go-powerdns/v3 (actively maintained, MIT, no runtime dependencies).

What does it do?

The provider's PDNSAPIProvider interface, retry logic, zone partitioning, and ALIAS handling are unchanged; only the client types underneath are swapped:

  • ListZonesZones.List, ListZoneZones.Get, PatchZoneRecords.Patch — same PATCH /servers/:id/zones/:zone API calls.
  • Interface signatures no longer return *http.Response (it was only used to debug-log error bodies; the new client parses the API error message into the returned error).
  • A RoundTripper preserves URL path prefixes in --pdns-server (e.g. API behind a reverse proxy at https://host/pdns), which the library would otherwise rewrite away. Existing setups keep working.
  • Test fixtures converted to the new client's types; test logic untouched.

Minor wire-level changes:

  • The deprecated set-ptr record field (removed in PowerDNS ≥ 4.3) is no longer serialized.
  • User-Agent is now go-powerdns.
  • CNAME/MX record contents are canonicalized (trailing dot) by the client on patch — a no-op, the provider already ensures trailing dots.

Checklist

  • Unit tests updated (go test -race ./provider/pdns/... passes)
  • End user documentation updated (update tutorial with local testing instructions)

@k8s-ci-robot k8s-ci-robot added the provider Issues or PRs related to a provider label Jun 11, 2026
@k8s-ci-robot k8s-ci-robot requested a review from vflaux June 11, 2026 00:21
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 11, 2026
@coveralls

coveralls commented Jun 11, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 27509177264

Coverage decreased (-0.02%) to 81.341%

Details

  • Coverage decreased (-0.02%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 53 coverage regressions across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

53 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
pdns/pdns.go 53 67.74%

Coverage Stats

Coverage Status
Relevant Lines: 21137
Covered Lines: 17193
Line Coverage: 81.34%
Coverage Strength: 1475.07 hits per line

💛 - Coveralls

@mloiseleur

mloiseleur commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

Tested this change locally end-to-end against PowerDNS 4.9 (powerdns/pdns-auth-49 in Docker) with a kind cluster and an annotated Service, following the instructions added in Testing locally with Docker and kind.

Create:

time="2026-06-11T02:40:50+02:00" level=info msg="CREATE: echo.example.com 0 IN A  10.96.185.122 []"
time="2026-06-11T02:40:50+02:00" level=info msg="CREATE: a-echo.example.com 0 IN TXT  \"heritage=external-dns,external-dns/owner=local-test,external-dns/resource=service/default/echo\" []"
time="2026-06-11T02:40:50+02:00" level=info msg="Changes pushed out to PowerDNS in 5.24128ms\n"

Update after kubectl annotate service echo external-dns.kubernetes.io/ttl=120:

time="2026-06-11T02:41:05+02:00" level=info msg="UPDATE-NEW: echo.example.com 120 IN A  10.96.185.122 []"
time="2026-06-11T02:41:05+02:00" level=info msg="UPDATE-NEW: a-echo.example.com 0 IN TXT  \"heritage=external-dns,external-dns/owner=local-test,external-dns/resource=service/default/echo\" []"

Delete after kubectl delete service echo:

time="2026-06-11T02:41:05+02:00" level=info msg="DELETE: echo.example.com 120 IN A  10.96.185.122 []"
time="2026-06-11T02:41:05+02:00" level=info msg="DELETE: a-echo.example.com 0 IN TXT  \"heritage=external-dns,external-dns/owner=local-test,external-dns/resource=service/default/echo\" []"

Also tested with the API behind an nginx reverse proxy at a URL path prefix (--pdns-server=http://localhost:8082/pdns), since the new client rewrites the request path to /api/v1/... and the provider now re-prepends the prefix via a RoundTripper:

time="2026-06-11T02:41:38+02:00" level=info msg="CREATE: echo.example.com 0 IN A  10.96.215.157 []"
time="2026-06-11T02:41:38+02:00" level=info msg="Changes pushed out to PowerDNS in 4.454681ms\n"

Resolution:

$ dig +short @127.0.0.1 -p 1053 echo.example.com A
10.96.215.157

Re-running with all records in place is a no-op:

time="2026-06-11T02:46:41+02:00" level=info msg="All records are already up to date"

@clwluvw @mark-liu @ngnix @blsho — you contributed to the PDNS provider in the last 2 years. If you can review this PR or test it, it would be great!

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 12, 2026
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 12, 2026

@vflaux vflaux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 13, 2026
…-powerdns/v3

The ffledgling/pdns-go client is pinned to a 2018 commit of a personal
fork that has been idle since 2019 with no releases. Replace it with
the actively maintained joeig/go-powerdns/v3 (MIT, zero runtime
dependencies).

The provider keeps the same PDNSAPIProvider interface and retry
behavior; only the underlying client types change. A RoundTripper
preserves URL path prefixes in --pdns-server (e.g. API behind a
reverse proxy), which the new library would otherwise drop.

Wire-level deltas: the deprecated set-ptr field (removed in
PowerDNS >= 4.3) is no longer serialized, and the User-Agent header
is now "go-powerdns".
Document how to test the PDNS provider end-to-end on a local machine:
a disposable PowerDNS authoritative server in Docker and a kind cluster
with an annotated Service. All commands verified against PowerDNS 4.9
(create, idempotent re-run, update, delete, dig resolution).
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 14, 2026
@ivankatliarchuk

Copy link
Copy Markdown
Member

/approve

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ivankatliarchuk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. docs provider Issues or PRs related to a provider size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants