feat(crd): Support MX record with trailing dot#6163
feat(crd): Support MX record with trailing dot#6163HartmannVolker wants to merge 1 commit intokubernetes-sigs:masterfrom
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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
|
|
Welcome @HartmannVolker! |
|
Hi @HartmannVolker. 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. DetailsInstructions 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. |
There was a problem hiding this comment.
Missing before and after evidences/how-to-reproduce , so not clear how to reproduce and validate. Example expected #5085 (comment)
Missing documentation about MX record trailing dots requirement. Could be a breaking change, so the risk modifying this no clear.
| expectEndpoints: false, | ||
| expectError: false, | ||
| }, | ||
| { |
There was a problem hiding this comment.
can we have test without trailing dot as well
| if !isTXT && ((isNAPTR && !hasDot) || (!isNAPTR && hasDot)) { | ||
| illegalTarget = true | ||
| break | ||
| if !isTXT { |
There was a problem hiding this comment.
nesting if is not a great idea
consider something like
for _, target := range ep.Targets {
hasDot := strings.HasSuffix(target, ".")
// TXT can contain arbitrary text, skip dot validation.
if isTXT {
continue
}
// Records that require a trailing dot (hostnames).
requiresDot := isNAPTR || isMx
if requiresDot && !hasDot {
illegalTarget = true
break
}
if !requiresDot && hasDot {
illegalTarget = true
break
}
}
There was a problem hiding this comment.
Or we could avoid growing list of boolean variables entiretly
illegalTarget := false
for _, target := range ep.Targets {
hasDot := strings.HasSuffix(target, ".")
switch ep.RecordType {
case endpoint.RecordTypeTXT:
continue // TXT records allow arbitrary text, skip validation
case endpoint.RecordTypeNAPTR, endpoint.RecordTypeMX:
illegalTarget = !hasDot // Must have trailing dot
default:
illegalTarget = hasDot // Must NOT have trailing dot
}
if illegalTarget {
break
}
}
|
/ok-to-test |
Pull Request Test Coverage Report for Build 21622765263Details
💛 - Coveralls |
|
MX target could have trailing dot, but is not mandatory. Most likely both cases are valid |
What does it do ?
This PR allows trailing dots in MX Record targets, allowing to use a different FQDN for your Mail server
Motivation
Currently trailing dots are not supported in MX records that are created using the DNSEndpoint CRD. But an MX record with a trailing dot signifies a FQDN, instructing the DNS server not to append the root domain to the entry, which is important in case your Mail server is not running under the same domain.
Currently external DNS throughs a warning like this if the target has a trailing dot:
More