-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(cloudflare): add support for MX records #5283
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
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
Hi @arthlr. 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 Once the patch is verified, the new status will be reflected by the 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. |
/ok-to-test |
14185d5
to
4f51703
Compare
/retest |
provider/cloudflare/cloudflare.go
Outdated
|
||
priority := (*uint16)(nil) | ||
if ep.RecordType == "MX" { | ||
parsedPriority, mailHost, err := parseMXRecord(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already similar logic in endpoint.ValidateMXRecord()
I would suggest to deduplicate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 more specific provider implementations of the parsing standard record:
https://github.com/kubernetes-sigs/external-dns/blob/master/provider/azure/common.go#L31-L47
https://github.com/kubernetes-sigs/external-dns/blob/master/provider/digitalocean/digital_ocean.go#L665-L678
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I will deduplicate then 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have deduplicated the logic of endpoint.ValidateMXRecord()
by changing a bit the logic and the return values. However, I have added tests to increase the cover of this part.
registry/txt.go
Outdated
@@ -108,7 +108,7 @@ func NewTXTRegistry(provider provider.Provider, txtPrefix, txtSuffix, ownerID st | |||
} | |||
|
|||
func getSupportedTypes() []string { | |||
return []string{endpoint.RecordTypeA, endpoint.RecordTypeAAAA, endpoint.RecordTypeCNAME, endpoint.RecordTypeNS} | |||
return []string{endpoint.RecordTypeA, endpoint.RecordTypeAAAA, endpoint.RecordTypeCNAME, endpoint.RecordTypeNS, endpoint.RecordTypeMX, endpoint.RecordTypeTXT} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the idea to use txt registry for the txt records.
If it's not an integral part of the PR, i would postpone it until we better understand the txt registry roadmap, especially the part of deprecating old records.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove it then 👍
However, we'll need it one day (I would like to use MX and TXT records to automatically deploy sengrid-like DNS records)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using the TXT registry, specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I am not using AWS and still don't want a noop
registry.
Then, a TXT registry, to store the metadata of TXT records created by external-dns is must-have for my team and I.
provider/cloudflare/cloudflare.go
Outdated
@@ -801,7 +839,7 @@ func (p *CloudFlareProvider) newCustomHostname(customHostname string, origin str | |||
} | |||
} | |||
|
|||
func (p *CloudFlareProvider) newCloudFlareChange(action string, ep *endpoint.Endpoint, target string, current *endpoint.Endpoint) *cloudFlareChange { | |||
func (p *CloudFlareProvider) newCloudFlareChange(action string, ep *endpoint.Endpoint, target string, current *endpoint.Endpoint) (*cloudFlareChange, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to add error
to the return values?
it's always nil, and this method is not intended to ever fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add an error, because the behavior of p.newCloudFlareChange
changes. Since we're now parsing the MX record, there's a possibility that the parsing might fail. In such cases, we need to explicitly return that the change won't occur because the parsing didn't succeed.
@mrozentsvayg anything left on your side ? |
Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
…red targets Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
Signed-off-by: Arthur Le Roux <[email protected]>
Hi there! 👋
Description
This PR introduces support for MX records for the Cloudflare provider.
Fixes #5282
Checklist
Thanks for checking this out! 🙏
Looking forward to your feedback — happy to make any changes if needed.