Skip to content

feat(crd): Support MX record with trailing dot#6163

Open
HartmannVolker wants to merge 1 commit intokubernetes-sigs:masterfrom
HartmannVolker:master
Open

feat(crd): Support MX record with trailing dot#6163
HartmannVolker wants to merge 1 commit intokubernetes-sigs:masterfrom
HartmannVolker:master

Conversation

@HartmannVolker
Copy link

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:

Endpoint <endpoint name> with DNSName fqdn.example.com. has an illegal target format.

More

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

Details 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

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 3, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: HartmannVolker / name: Volker Hartmann (f6cd8c1)

@k8s-ci-robot
Copy link
Contributor

Welcome @HartmannVolker!

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. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 3, 2026
@k8s-ci-robot
Copy link
Contributor

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 /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.

Details

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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. 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 Feb 3, 2026
Copy link
Member

@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.

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,
},
{
Copy link
Member

Choose a reason for hiding this comment

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

can we have test without trailing dot as well

if !isTXT && ((isNAPTR && !hasDot) || (!isNAPTR && hasDot)) {
illegalTarget = true
break
if !isTXT {
Copy link
Member

Choose a reason for hiding this comment

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

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
	}
}

Copy link
Member

Choose a reason for hiding this comment

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

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
	}
}

@ivankatliarchuk
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added 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 Feb 7, 2026
@coveralls
Copy link

Pull Request Test Coverage Report for Build 21622765263

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.003%) to 79.161%

Files with Coverage Reduction New Missed Lines %
openshift_route.go 1 83.97%
crd.go 2 68.1%
Totals Coverage Status
Change from base Build 21559764040: 0.003%
Covered Lines: 16046
Relevant Lines: 20270

💛 - Coveralls

@ivankatliarchuk
Copy link
Member

MX target could have trailing dot, but is not mandatory. Most likely both cases are valid

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants