external-dns icon indicating copy to clipboard operation
external-dns copied to clipboard

Add support for MX and SRV records in pdns provider

Open saravanan30erd opened this issue 1 year ago • 13 comments

Description

This PR enables MX and SRV record support for PowerDNS provider in ExternalDNS. Especially for PowerDNS API, it requires explicit trailing dot for records having FQDN such as CNAME, MX, SRV, etc.. For CNAME record, its already covered here https://github.com/kubernetes-sigs/external-dns/blob/master/provider/pdns/pdns.go#L317-L318 so I added trailing dot for MX and SRV records now.

Errors Fixed

Error from PDNS API for SRV record creation

level=debug msg="PDNS API response:
level=fatal msg="Failed to do run once: Status: 422 Unprocessable Entity, Body: {\"error\": \"Record _service._tls.example.com./SRV '100 1 443 service.example.com': Not in expected format (parsed as '100 1 443 service.example.com.')\"}"

Error from PDNS API for MX record creation

level=fatal msg="Failed to do run once: Status: 422 Unprocessable Entity, Body: {\"error\": \"Record test.example.com./MX '10 mailhost1.example.com': Not in expected format (parsed as '10 mailhost1.example.com.')\"}

The above errors is fixed by this PR.

Fixes #3930 #4267

Checklist

  • [x] Unit tests updated
  • [x] End user documentation updated

saravanan30erd avatar Aug 01 '24 10:08 saravanan30erd

Welcome @saravanan30erd!

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. :smiley:

k8s-ci-robot avatar Aug 01 '24 10:08 k8s-ci-robot

Hi @saravanan30erd. 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 avatar Aug 01 '24 10:08 k8s-ci-robot

I'm not sure to understand the context of this PR. Are you saying that, with this PR, it adds a needed trailing dot but it's still failing on PDNS ? Or are you saying that, with this PR, the added trailing dot fix the issue observed with PDNS ?

Anyway, no PR on the code merge without test. So would you please update the tests accordingly ?

mloiseleur avatar Aug 09 '24 07:08 mloiseleur

@mloiseleur

are you saying that, with this PR, the added trailing dot fix the issue observed with PDNS ?

Yes.

PDNS API expects trailing dot for both these MX and SRV records. Without trailing dots, we are getting the errors mentioned in this issue https://github.com/kubernetes-sigs/external-dns/issues/3930

I have added required trailing dots for these two records now same as CNAME and ALIAS records, after adding trailing dots we can create MX and SRV records in PDNS using external dns without any issues. Trailing dots are added already to CNAME and ALIAS records here https://github.com/kubernetes-sigs/external-dns/blob/master/provider/pdns/pdns.go#L317-L318

saravanan30erd avatar Aug 09 '24 08:08 saravanan30erd

@saravanan30erd Then wdyt of rewriting in this PR description "Errors to be fixed" with something like "Fixed errors" ?

Anyway, once it's tested, it can be reviewed.

mloiseleur avatar Aug 09 '24 09:08 mloiseleur

@mloiseleur

Then wdyt of rewriting in this PR description "Errors to be fixed" with something like "Fixed errors" ?

Done, changed the PR description.

Anyway, once it's tested, it can be reviewed.

Sure, will add the tests.

saravanan30erd avatar Aug 09 '24 09:08 saravanan30erd

@mloiseleur I have updated the test cases for this change. Please review it, thanks.

saravanan30erd avatar Aug 11 '24 17:08 saravanan30erd

/lgtm

mloiseleur avatar Aug 12 '24 07:08 mloiseleur

Hi @mloiseleur Thanks for the review.

Is there anything I can do on my end to help move it forward? Please let me know if there's anything I can assist with.

saravanan30erd avatar Aug 14 '24 06:08 saravanan30erd

/ok-to-test

mloiseleur avatar Aug 14 '24 07:08 mloiseleur

@saravanan30erd One of the other maintainer will review it when he has time.

BTW, we have started the process to move the providers out of tree. Feel free to host your own pdns provider.

mloiseleur avatar Aug 14 '24 07:08 mloiseleur

Thanks, bot told to assign it to @Raffo so assigning it.

Once this PR has been reviewed and has the lgtm label, please assign raffo for approval.

/assign @Raffo

saravanan30erd avatar Aug 14 '24 08:08 saravanan30erd

@Raffo @szuecs When you have a moment, kindly please review this PR.

saravanan30erd avatar Sep 12 '24 07:09 saravanan30erd

@Raffo Gentle Reminder. I wanted to kindly check if you’ve had a chance to review this PR.

saravanan30erd avatar Oct 02 '24 13:10 saravanan30erd

/approve

Raffo avatar Oct 03 '24 08:10 Raffo

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Raffo

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 avatar Oct 03 '24 08:10 k8s-ci-robot