Skip to content
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

feat: adguard home provider #3249

Closed
wants to merge 2 commits into from

Conversation

markussiebert
Copy link

Description

This PR adds the adguard home provider. With this provider you can manage records in adguard home.

"AdGuard Home is a network-wide software for blocking ads and tracking. After you set it up, it'll cover ALL your home devices, and you don't need any client-side software for that. It operates as a DNS server that re-routes tracking domains to a “black hole”, thus preventing your devices from connecting to those servers. It's based on software we use for our public AdGuard DNS servers, and both share a lot of code."
from adguard home

Fixes #3243

Checklist

  • Unit tests updated (wip)
  • End user documentation updated (not started right now)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 16, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Dec 16, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @markussiebert!

It looks like this is your first PR to kubernetes-sigs/external-dns 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/external-dns has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@markussiebert markussiebert marked this pull request as draft December 16, 2022 20:00
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 16, 2022
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 16, 2022
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 3, 2023
}

func genAdguardCustomRuleRecord(e *endpoint.Endpoint) string {
return fmt.Sprintf("%s$dnstype=%s,dnsrewrite=NOERROR;%s;%s", e.DNSName, e.RecordType, e.RecordType, e.Targets.String())
Copy link

@ruifung ruifung Jan 9, 2023

Choose a reason for hiding this comment

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

Suggest wrapping the DNSName in |%s| because otherwise a record for example.com will also match test.example.com or test.example.com.example.com

Default matching mode in AGH appears to be "contains substring"

As per https://github.com/AdguardTeam/AdGuardHome/wiki/Hosts-Blocklists#adblock-style
wrapping the record name in || to match the beginning and end should cause it to perform an exact match.

i.e. "|%s|$dnstype=%s,dnsrewrite=NOERROR;%s;%s"


func parseAdguardCustomRuleRecord(s string) *endpoint.Endpoint {

matched := regex.FindStringSubmatch(s)
Copy link

Choose a reason for hiding this comment

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

The regex for this will likely need to be altered for the above comment too.

// NewAdguardHomeProvider initializes a new Vultr BNS based provider
func NewAdguardHomeProvider(domainFilter endpoint.DomainFilter, dryRun bool) (*AdguardHomeProvider, error) {
adguardHomeURL, adguardHomeUrlOk := os.LookupEnv("ADGUARD_HOME_URL")
if !adguardHomeUrlOk {
Copy link

Choose a reason for hiding this comment

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

Might want to document that the AGH URL passed here needs to be suffixed with /control/ for a regular AGH deployment. Since that's where the APIs are under.

Copy link

Choose a reason for hiding this comment

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

I got confused trying to troubleshoot that with a very unhelpful error about a nil reference.

Copy link
Author

Choose a reason for hiding this comment

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

You are right - it took me some time to figure Out the right path...

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 21, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: markussiebert
Once this PR has been reviewed and has the lgtm label, please assign njuettner for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 14, 2023
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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/test-infra repository.

@mloiseleur
Copy link
Contributor

We won't merge any new providers. See #3063.
You are more than welcome to (re)use this PR to publish a webhook provider for external-dns or contribute/use the already existing one
=> I'm closing this PR.
/close

@k8s-ci-robot
Copy link
Contributor

@mloiseleur: Closed this PR.

In response to this:

We won't merge any new providers. See #3063.
You are more than welcome to (re)use this PR to publish a webhook provider for external-dns or contribute/use the already existing one
=> I'm closing this PR.
/close

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/test-infra repository.

@mloiseleur mloiseleur mentioned this pull request Oct 11, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. new-provider size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adguard Home Support (new Provider)
5 participants