Skip to content

feat(pihole): add support for IPv6 Dual format #5253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 23, 2025

Conversation

tJouve
Copy link
Contributor

@tJouve tJouve commented Apr 6, 2025

Description

Fixes #5251

This PR add support for IPv6 Dual with the following format : y:y:y:y:y:y:x.x.x.x

PiHole support such IPs but previous implementations did not take it in account.
External DNS was able to push such record, but can not read it from the provider (the record was filtered out because mark as IPV6 but containing a '.' . Finally External DNS try to push again the record but the provider return an error because the record is duplicated.

This implementation fix this and the test used to determine if it is an IPv4 or IPv6 is more robust.

Also get rid of instrumented_http, httpClient is enough. See #5226 (comment) .

No change done on the V5 implementation as it is now deprecated.

Checklist

  • Unit tests updated
  • End user documentation updated

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 6, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @tJouve. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 6, 2025
@ivankatliarchuk
Copy link
Contributor

instrumented_http configures http metrics...

@ivankatliarchuk
Copy link
Contributor

/ok-to-test
/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 6, 2025
Copy link
Contributor

@ivankatliarchuk ivankatliarchuk left a comment

Choose a reason for hiding this comment

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

instead of

out = append(out, &endpoint.Endpoint{
			DNSName:    DNSName,
			Targets:    []string{Target},
			RecordTTL:  Ttl,
			RecordType: rtype,
})

could we use, this will help us improve code at some

NewEndpoint()...

@tJouve
Copy link
Contributor Author

tJouve commented Apr 6, 2025

instrumented_http configures http metrics...

I rollback this one

Copy link
Contributor

@ivankatliarchuk ivankatliarchuk left a comment

Choose a reason for hiding this comment

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

/lgtm

may need someone to validate where or not it solves a problem

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 7, 2025
@tJouve
Copy link
Contributor Author

tJouve commented Apr 7, 2025

@tholinka is it ok for you to test this one ?

@tholinka
Copy link

tholinka commented Apr 7, 2025

It works without crashing now, all records show up in Pi-Hole as expected!

The logs do get spammed with invalid format received from PiHole every run though:

It seems like it's trying to parse every A and AAAA record as AAAA and A as well.

time="2025-04-07T18:40:04-05:00" level=info msg="PUT internal.domain.name IN AAAA -> ::ffff:192.168.20.3"
time="2025-04-07T18:40:04-05:00" level=info msg="PUT internal.domain.name IN A -> 192.168.20.3"
time="2025-04-07T18:40:04-05:00" level=info msg="PUT external.domain.name IN A -> 192.168.20.4"
time="2025-04-07T18:40:04-05:00" level=info msg="PUT external.domain.name IN AAAA -> ::ffff:192.168.20.4"
time="2025-04-07T18:41:04-05:00" level=warning msg="skipping A record ::ffff:192.168.20.3 internal.domain.name: invalid format received from PiHole"
time="2025-04-07T18:41:04-05:00" level=warning msg="skipping A record ::ffff:192.168.20.4 external.domain.name: invalid format received from PiHole"
time="2025-04-07T18:41:05-05:00" level=warning msg="skipping AAAA record 192.168.20.3 internal.domain.name: invalid format received from PiHole"
time="2025-04-07T18:41:05-05:00" level=warning msg="skipping AAAA record 192.168.20.4 external.domain.name: invalid format received from PiHole"
time="2025-04-07T18:41:05-05:00" level=info msg="All records are already up to date"
time="2025-04-07T18:42:04-05:00" level=warning msg="skipping A record ::ffff:192.168.20.3 internal.domain.name: invalid format received from PiHole"
time="2025-04-07T18:42:04-05:00" level=warning msg="skipping A record ::ffff:192.168.20.4 external.domain.name: invalid format received from PiHole"
time="2025-04-07T18:42:05-05:00" level=warning msg="skipping AAAA record 192.168.20.3 internal.domain.name: invalid format received from PiHole"
time="2025-04-07T18:42:05-05:00" level=warning msg="skipping AAAA record 192.168.20.4 external.domain.name: invalid format received from PiHole"
time="2025-04-07T18:42:05-05:00" level=info msg="All records are already up to date"

Should not log records reject by filter on listRecords because PiHole return A and AAAA records. It is normal to filter some records
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 8, 2025
@tJouve
Copy link
Contributor Author

tJouve commented Apr 8, 2025

crashing now, all records show up in Pi-Hole as expected!

OK, I removed the logs because it is a normal behaviour : PiHole return both A and AAAA records. So it is normal to filter out some records

Co-authored-by: Michel Loiseleur <[email protected]>
Copy link

@tholinka tholinka left a comment

Choose a reason for hiding this comment

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

Deployed the newest commit and it's working

@k8s-ci-robot
Copy link
Contributor

@tholinka: changing LGTM is restricted to collaborators

In response to this:

Deployed the newest commit and it's working

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ivankatliarchuk
Copy link
Contributor

cc: @mloiseleur

@mloiseleur
Copy link
Collaborator

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 23, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ivankatliarchuk, mloiseleur, tholinka

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

The pull request process is described here

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 Apr 23, 2025
@k8s-ci-robot k8s-ci-robot merged commit c49322f into kubernetes-sigs:master Apr 23, 2025
13 checks passed
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pi-Hole v6 AAAA dual record causes crashback loop
6 participants