Skip to content
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

Add support for AAAA records #2461

Merged
merged 10 commits into from
Apr 13, 2023
Merged

Conversation

johngmyers
Copy link
Contributor

@johngmyers johngmyers commented Dec 5, 2021

Adds support for managing AAAA records.

Fixes #2300
Fixes #1812
Fixes #2051

Checklist

  • Unit tests updated
  • End user documentation updated (it doesn't state external-dns doesn't support AAAA)

Bringing work started in #2309 to completion, as that PR's author has expressed that they will not be moving the work forward at this time.

Tested against the Route53 provider and the TXT registry. The external-dns AWS SD registry code likely does not support AAAA records.

This touches on multi-target, since dual-stack targets need both an A and an AAAA record. This PR solves the dual-stack problem by creating separate Endpoint objects for the A and AAAA record and extending the TXT registry to store ownership records for AAAA Endpoints under a different domain.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 5, 2021
@johngmyers johngmyers mentioned this pull request Dec 5, 2021
2 tasks
@samip5
Copy link
Contributor

samip5 commented Dec 5, 2021

It's sad that you twisted my words, because that's not what I said.

@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 10, 2021
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 11, 2021
@MTRNord
Copy link

MTRNord commented Jan 7, 2022

Hm I know this is fairly early, but it seems the current code does something weird for the txt records.

It fails with No matching zones were found for the following endpoints: [aaaadocs.nordgedanken.dev-tls 0 IN TXT (shortened the log). It seems very odd that it tries to use the tls secret instead of the host of the ingress. And obviously that's not going to work.

@johngmyers
Copy link
Contributor Author

@MTRNord could you provide reproduction steps?

@MTRNord
Copy link

MTRNord commented Jan 7, 2022

Oh I see what happens here. A helm chart I am using is setting the tls hosts with that postfix. Sorry. I only just realized why I wanted to send you an ingress that fail. So the issue is in the helm chart used, not in external dns.

@anthr76
Copy link

anthr76 commented Jan 21, 2022

Is there anything left on this besides review? @johngmyers do you have an image availble to test?

@adamcharnock
Copy link

@anthr76 (any anyone else in need) – I've built this image and pushed it to docker hub. It is:

adamcharnock/external-dns-ipv6:v0.10.2-8-g23bf88d9

Looking forward to this being in an official release :-)

@johngmyers
Copy link
Contributor Author

I'm not aware of anything other than review being needed. I tested on a frankenimage including commits from #2419 because I had difficulty creating IPv6-capable Ingresses due to AWS LBC not supporting k8s > 1.21.

@johngmyers
Copy link
Contributor Author

There are going to be followup PRs extending AAAA support to other resources and possibly the AWS SD registry.

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

What's the reason for the extra registry TXT record? is that in case there may be different owners for A and AAAA?

@johngmyers
Copy link
Contributor Author

johngmyers commented Jan 27, 2022

@olemarkus The record type is a field of Endpoint. To be able to have both A and AAAA DNS records for the same DNSName, there are two possible approaches:

  1. Have one Endpoint of RecordTypeA and another of RecordTypeAAAA. Since each Endpoint needs an ownership entry in the registry, that means the TXTRegistry needs to store a separate TXT record under a different DNSName for the AAAA Endpoint.

  2. Push the RecordType field of Endpoint down into the Targets. This would be a much more substantial change, requiring a change to every Provider implementation. It seemed to me that this approach would have a much lower probability of success.

This PR takes approach (1).

@NobodysNightmare
Copy link
Contributor

Just for cross-reference, this will most likely also help fix: #1877

DNSName: "foo.bar",
Targets: endpoint.Targets{"8.8.8.8"},
DNSName: "foo.bar",
RecordType: endpoint.RecordTypeA,
Copy link
Member

Choose a reason for hiding this comment

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

what about adding some tests for endpoint.RecordTypeAAAA? I feel like we only slightly adjust the old tests being passed but not adding new tests for testing AAAA

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a test case for extracting an AAAA from an Ingress status. Are there any other areas where you think this is lacking coverage?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

@njuettner njuettner left a comment

Choose a reason for hiding this comment

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

First of all thank you for addressing support for AAAA records, this is huge change and I might need you to add some documentation how people can use the new records so I'd appreciate if you could add some sentences how it works 🙏🏻.

Again thank you for you work and picking it up again.

@johngmyers
Copy link
Contributor Author

My understanding is that this PR only adds picking up AAAA from Ingress. Picking up AAAA from other resource types is for followup PRs. I plan on submitting said followup PRs.

I'm not sure what to add to the documentation about how to use this. One doesn't do anything different than what the existing documentation describes; it's just that AAAA records now get registered in DNS whereas before they were omitted. And I think it's outside the scope of this package's documentation to crib RFC 3596.

How it works: the plan separates the two types of addresses into two different Endpoints for the same domain. The registry then has to support simultaneously registering A and AAAA Endpoints for the same domain, so the TXT registry treats AAAA records as a special case when transforming the domain.

So could you give a little more detail on what/where you want additional documentation? An addition to the "Ownership" sections of docs/initial-design.md? Something about the planner, which doesn't appear to be currently documented?

@morremeyer
Copy link
Contributor

@szuecs does this need your /lgtm or is @njuettner the one who needs to give that since he requested charges?

@olemarkus
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 13, 2023
@k8s-ci-robot k8s-ci-robot merged commit e48ec6b into kubernetes-sigs:master Apr 13, 2023
@johngmyers johngmyers deleted the quad-a branch April 13, 2023 22:12
@szuecs
Copy link
Contributor

szuecs commented Apr 14, 2023

/lgtm

@szuecs
Copy link
Contributor

szuecs commented Apr 14, 2023

@olemarkus that was not fine to lgtm, sorry to say this. I reached out to other maintainers to review. Please don't do this again, thanks!

@olemarkus
Copy link
Contributor

Sorry about that. But lgtm means community members has reviewed and find the code good. There are thousands with that privilege. Approvals is the method for ensuring actual owners do final reviews and confirm all is good for merge.

Typically code owners would just lgtm if they want other owners to do second reviews. Or use holds.

@szuecs
Copy link
Contributor

szuecs commented Apr 14, 2023

@olemarkus ok thanks, then I just missed the idea of lgtm/approve split.

@johngmyers
Copy link
Contributor Author

The roles and responsibilites of Kubernetes contributors are well-established and documented in https://github.com/kubernetes/community/blob/master/community-membership.md. As a Member, @olemarkus was working entirely within expectations to give lgtm.

@szuecs
Copy link
Contributor

szuecs commented Apr 15, 2023

@johngmyers yes my bad because approve is maintainer (owner) responsibility, lgtm everyone in the org. A bit weird to me tbh.

@johngmyers johngmyers mentioned this pull request Jun 7, 2023
2 tasks
cronik added a commit to cronik/external-dns that referenced this pull request Jun 28, 2023
When AAAA multi-target / dual stack support was added via kubernetes-sigs#2461 it broke ownership of domains across different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change introduces a new configuration point that
which by default will only cause AAAA records to be
managed independently of A and CNAME records.
This should preserve the dual stack / multi-target use
case while preserving ownership of across different
clusters. This configuration can be overridden using
the new option `--dual-stack-record-types`. For
example to revert back to the current behavior where
all record types are treated as independent the
configuration would be:

`--dual-stack-record-types AAAA --dual-stack-record-types A --dual-stack-record-types CNAME`
cronik added a commit to cronik/external-dns that referenced this pull request Jun 28, 2023
When AAAA multi-target / dual stack support was
added via kubernetes-sigs#2461 it broke ownership of domains across
different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change introduces a new configuration point that
which by default will only cause AAAA records to be
managed independently of A and CNAME records.
This should preserve the dual stack / multi-target use
case while preserving ownership of across different
clusters. This configuration can be overridden using
the new option `--dual-stack-record-types`. For
example to revert back to the current behavior where
all record types are treated as independent the
configuration would be:

`--dual-stack-record-types AAAA --dual-stack-record-types A --dual-stack-record-types CNAME`
cronik added a commit to cronik/external-dns that referenced this pull request Jun 30, 2023
When AAAA multi-target / dual stack support was
added via kubernetes-sigs#2461 it broke ownership of domains across
different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change updates the planner to keep track of multiple
current records for a domain. This allows for A and AAAA
records to exist for a domain while allowing record type
changes. Similarly candidate records are grouped by
record type to support dual stack records.
cronik added a commit to cronik/external-dns that referenced this pull request Jul 14, 2023
When AAAA multi-target / dual stack support was
added via kubernetes-sigs#2461 it broke ownership of domains across
different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change updates the planner to keep track of multiple
current records for a domain. This allows for A and AAAA
records to exist for a domain while allowing record type
changes.

The planner will ignore desired records for a domain that
represent conflicting record types allowed by RFC 1034 3.6.2.
For example if the desired records for a domain contains
a CNAME record plus any other record type no changes for
that domain will be planned.

The planner now contains an owned record filter provided
by the registry. This allows the planner to accurately plan
create updates when there are record type changes between
the current and desired endpoints. Without this filter the
planner could add create changes for domains not owned
by the controller.
cronik added a commit to cronik/external-dns that referenced this pull request Jul 14, 2023
When AAAA multi-target / dual stack support was
added via kubernetes-sigs#2461 it broke ownership of domains across
different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change updates the planner to keep track of multiple
current records for a domain. This allows for A and AAAA
records to exist for a domain while allowing record type
changes.

The planner will ignore desired records for a domain that
represent conflicting record types allowed by RFC 1034 3.6.2.
For example if the desired records for a domain contains
a CNAME record plus any other record type no changes for
that domain will be planned.

The planner now contains an owned record filter provided
by the registry. This allows the planner to accurately plan
create updates when there are record type changes between
the current and desired endpoints. Without this filter the
planner could add create changes for domains not owned
by the controller.
cronik added a commit to cronik/external-dns that referenced this pull request Jul 23, 2023
When AAAA multi-target / dual stack support was
added via kubernetes-sigs#2461 it broke ownership of domains across
different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change updates the planner to keep track of multiple
current records for a domain. This allows for A and AAAA
records to exist for a domain while allowing record type
changes.

The planner will ignore desired records for a domain that
represent conflicting record types allowed by RFC 1034 3.6.2.
For example if the desired records for a domain contains
a CNAME record plus any other record type no changes for
that domain will be planned.

The planner now contains an owned record filter provided
by the registry. This allows the planner to accurately plan
create updates when there are record type changes between
the current and desired endpoints. Without this filter the
planner could add create changes for domains not owned
by the controller.
cronik added a commit to cronik/external-dns that referenced this pull request Jul 23, 2023
When AAAA multi-target / dual stack support was
added via kubernetes-sigs#2461 it broke ownership of domains across
different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change updates the planner to keep track of multiple
current records for a domain. This allows for A and AAAA
records to exist for a domain while allowing record type
changes.

The planner will ignore desired records for a domain that
represent conflicting record types allowed by RFC 1034 3.6.2.
For example if the desired records for a domain contains
a CNAME record plus any other record type no changes for
that domain will be planned.

The planner now contains an owned record filter provided
by the registry. This allows the planner to accurately plan
create updates when there are record type changes between
the current and desired endpoints. Without this filter the
planner could add create changes for domains not owned
by the controller.
cronik added a commit to cronik/external-dns that referenced this pull request Jul 23, 2023
When AAAA multi-target / dual stack support was
added via kubernetes-sigs#2461 it broke ownership of domains across
different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change updates the planner to keep track of multiple
current records for a domain. This allows for A and AAAA
records to exist for a domain while allowing record type
changes.

The planner will ignore desired records for a domain that
represent conflicting record types allowed by RFC 1034 3.6.2.
For example if the desired records for a domain contains
a CNAME record plus any other record type no changes for
that domain will be planned.

The planner now contains an owned record filter provided
by the registry. This allows the planner to accurately plan
create updates when there are record type changes between
the current and desired endpoints. Without this filter the
planner could add create changes for domains not owned
by the controller.
cronik added a commit to cronik/external-dns that referenced this pull request Aug 17, 2023
When AAAA multi-target / dual stack support was
added via kubernetes-sigs#2461 it broke ownership of domains across
different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change updates the planner to keep track of multiple
current records for a domain. This allows for A and AAAA
records to exist for a domain while allowing record type
changes.

The planner will ignore desired records for a domain that
represent conflicting record types allowed by RFC 1034 3.6.2.
For example if the desired records for a domain contains
a CNAME record plus any other record type no changes for
that domain will be planned.

The planner now contains an owned record filter provided
by the registry. This allows the planner to accurately plan
create updates when there are record type changes between
the current and desired endpoints. Without this filter the
planner could add create changes for domains not owned
by the controller.
cronik added a commit to cronik/external-dns that referenced this pull request Aug 17, 2023
When AAAA multi-target / dual stack support was
added via kubernetes-sigs#2461 it broke ownership of domains across
different clusters with different ingress records types.

For example if 2 clusters manage the same zone,
1 cluster uses A records and the other uses CNAME
records, when each record type is treated as a separate
planning record, it will cause ownership to bounce back
and forth and records to be constantly created and
deleted.

This change updates the planner to keep track of multiple
current records for a domain. This allows for A and AAAA
records to exist for a domain while allowing record type
changes.

The planner will ignore desired records for a domain that
represent conflicting record types allowed by RFC 1034 3.6.2.
For example if the desired records for a domain contains
a CNAME record plus any other record type no changes for
that domain will be planned.

The planner now contains an owned record filter provided
by the registry. This allows the planner to accurately plan
create updates when there are record type changes between
the current and desired endpoints. Without this filter the
planner could add create changes for domains not owned
by the controller.
@johngmyers johngmyers mentioned this pull request Sep 13, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet