Skip to content

Conversation

@u-kai
Copy link
Contributor

@u-kai u-kai commented Dec 14, 2025

What does it do ?

This PR introduces a new flag, --txt-prefix-override, as a safe and flexible workaround
to support apex domains when using the TXT registry.

The flag allows users to override the TXT record prefix per domain by specifying
one or more mappings in the following form:

--txt-prefix-override=domain=txt-prefix

Multiple overrides can be provided, and each mapping applies only to the explicitly
specified domain.

Motivation

In #5864, we discussed limitations and edge cases around managing apex domains with the
TXT registry.

While a flag such as --apex-domains was considered, it was intentionally avoided for
the following reasons:

  • A flag named --apex-domains could be misunderstood as applying special behavior to
    all apex domains automatically.
  • The underlying problem is not limited to apex domains; it is more generally about
    domain-specific TXT prefix customization.
  • Introducing a domain-scoped override mechanism keeps the behavior explicit and avoids
    surprising users.

By using --txt-prefix-override, users must opt in per domain, making the behavior
clear and predictable.

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

@k8s-ci-robot k8s-ci-robot added the apis Issues or PRs related to API change label Dec 14, 2025
@k8s-ci-robot k8s-ci-robot added controller Issues or PRs related to the controller docs internal Issues or PRs related to internal code needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. plan Issues or PRs related to external-dns plan labels Dec 14, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @u-kai. Thanks for your PR.

I'm waiting for a github.com 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 registry Issues or PRs related to a registry size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 14, 2025
@u-kai u-kai changed the title Feat/support overrides txt prefix feat: add --txt-prefix-override flag to support apex domains safely Dec 14, 2025

// normalizeDNSName converts a DNS name to a canonical form, so that we can use string equality
// it: removes space, get ASCII version of dnsName complient with Section 5 of RFC 5891, ensures there is a trailing dot
func normalizeDNSName(dnsName string) string {
Copy link
Member

Choose a reason for hiding this comment

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

This should be in it's own PR.

Copy link
Member

Choose a reason for hiding this comment

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

I may explain a bit more - some changes, like refactoring are easy to revew/approve/merge. While adding new capabilities or fixing certain behaviour has different SDLC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood, thanks for the clarification.
I’ve split this into a separate PR.

@ivankatliarchuk
Copy link
Member

Conceptually the change aligns with ExternalDNS’s goal of offering pragmatic knobs for tricky DNS layouts like apex records (this is just single opinion)

What I'm unsure

  1. Another new flag with prefix and domain mapping
  2. Missing any practical documentation - as without clear use case, no clear reason of adding features

We need to review pros-cons of adding flag complex vs annotation external-dns.alpha.kubernetes.io/txt-prefix as example.

Even then the change may still be reviewed and rejrected by project owners

@u-kai
Copy link
Contributor Author

u-kai commented Dec 20, 2025

@ivankatliarchuk

Another new flag with prefix and domain mapping

Thanks — I’m not sure I fully understand this concern yet.
Do you mean a case where multiple domains need different TXT prefix overrides?

If so, the current design supports this by allowing the flag to be specified multiple times at runtime.
If you meant something else, could you clarify what kind of mapping or complexity you’re concerned about?

Missing any practical documentation - as without clear use case, no clear reason of adding features

I’ve already added a detailed description to the flag itself, including the intended use case for apex records and support for multiple domains.

Would you prefer:

  • expanding the flag description further, or
  • adding a separate piece of documentation (e.g. a short guide or example section) that explains the practical use cases in more detail?

We need to review pros-cons of adding flag complex vs annotation external-dns.alpha.kubernetes.io/txt-prefix as example.

My current view is:

Annotation approach:

  • Pros: behavior is more visible and intuitive to users
  • Cons: requires implementation across all sources and TXT registry, and deciding how to propagate txt-prefix data through Endpoint

Flag approach (this PR):

  • Pros: change is mostly contained to TXT registry logic
  • Cons: ExternalDNS restart is required when flags change

From a maintenance and scope perspective, I chose the flag-based approach for now.

@ivankatliarchuk
Copy link
Member

Let's w8 for other parties to review and consider which approach should we choose.

  • Annotation over flag, could help conditionally configure it for specific resources
  • Flag of course has it's own advantages. But composite flags, when there is domain+prefix, not sure, feels quite tricky. If we have a configuration file support, it could be easier.

This PR slowly slips into area of #3757

Relates

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 28, 2025
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apis Issues or PRs related to API change cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. controller Issues or PRs related to the controller docs internal Issues or PRs related to internal code needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. plan Issues or PRs related to external-dns plan registry Issues or PRs related to a registry 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.

3 participants