fix(aws): incorrect behavior for non-aliasable record types#6017
fix(aws): incorrect behavior for non-aliasable record types#6017u-kai wants to merge 11 commits intokubernetes-sigs:masterfrom
Conversation
Signed-off-by: u-kai <76635578+u-kai@users.noreply.github.com>
Signed-off-by: u-kai <76635578+u-kai@users.noreply.github.com>
Signed-off-by: u-kai <76635578+u-kai@users.noreply.github.com>
Signed-off-by: u-kai <76635578+u-kai@users.noreply.github.com>
|
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 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. |
|
Refactoring and bug fix in single PR. Too risky. As well as for bug, it should be manifests provided to reproduce |
|
@ivankatliarchuk To make the existing issue easier to fix, I’ve opened a separate PR with the refactoring work. It would be great if you could review the refactoring PR first. Thanks! |
Signed-off-by: u-kai <76635578+u-kai@users.noreply.github.com>
|
@ivankatliarchuk |
|
Missing links to docs in description with facts about this behaviour. Missing end to end tests with the proof. I'll review only after other reviewers share their review. I could not keep approving on my own. |
|
There’s no example showing the current behaviour, so it’s unclear whether this is actually a problem or not. |
|
I’ve updated the PR description. Previously, even for record types that do not support alias (such as MX records), ExternalDNS was applying alias-specific behavior — updating TTL and adding the evaluateTargetHealth property — whenever This was incorrect and also hurt code readability. |
|
Missing before and after real example. And missing links to official documentation describing AWS alias record behavior |
| if isAlias, _ := ep.GetBoolProviderSpecificProperty(providerSpecificAlias); isAlias { | ||
| p.adjustAliasRecord(ep) | ||
| // NS and SOA records do not support alias | ||
| if ep.RecordType == endpoint.RecordTypeNS || ep.RecordType == "SOA" { |
There was a problem hiding this comment.
not sure about ep.RecordType == "SOA"
Pull Request Test Coverage Report for Build 23925061512Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
[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 |
Signed-off-by: u-kai <76635578+u-kai@users.noreply.github.com>
73b7319 to
ef7b98a
Compare
|
As noted in the code comments, AWS Route53 allows Alias records for record types other than NS and SOA. From a practical perspective, there is little real-world value in using Alias records for types other than A and AAAA. In fact, the current code already does not accept Alias records for MX during validation. While the concept of “Alias” exists across multiple providers, its semantics differ significantly. For example, GCP Cloud DNS ALIAS records are specifically designed to synthesize A/AAAA records at the zone apex and are not intended for use with MX or other non-address record types. To keep the Alias behavior simple and consistent across providers, this change removes the Alias property Previously, when non-CNAME records had the Alias property set, ExternalDNS applied Alias-specific settings This helps avoid ambiguous behavior and keeps the implementation aligned with practical use cases. |
|
Here is a concrete example to illustrate the behavior. Given the following DNSEndpoint: apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
name: alias
namespace: default
spec:
endpoints:
- dnsName: mail.example.com
recordType: MX
recordTTL: 600
targets:
- "10 mail1.example.com."
providerSpecific:
- name: "alias"
value: "true"With the previous behavior, when this was applied:
As a result, ExternalDNS detected a diff on every sync and continuously issued UPDATE requests, as shown in the logs, because alias-related properties were dropped during request generation for MX records. With the current change:
As a result, after the initial sync, no further UPDATE operations are triggered, and the record remains stable. This avoids unnecessary reconciliation loops and keeps the behavior consistent with what the provider actually supports.
|
|
I gotcha now. What’s bothering me isn’t the mechanics of the fix, it’s where the responsibility boundary is being moved. Right now this PR quietly shifts user configuraiont error handling into the AWS provider, and that’s a design smell. An MX record with If the input is invalid:
Silently “fixing” it in the provider:
ExternalDNS already has clear layering: The provider’s job is:
Not:
This PR does exactly that:
That’s backwards. |
|
Now:
ExternalDNS should enforce provider-agnostic semantics before provider code runs. |
|
Ideally, what we should have Reject invalid combinations at middleware layer:
This is the cleanest contract. |
|
Totally agree — the issue here is the responsibility boundary. To move in that direction, I opened a follow-up PR that makes endpoint validation fail when alias=true is used for non A/AAAA,CNAME record types. Once that PR is merged, this PR can be simplified further. I’ll update this PR accordingly once the validation change lands. |
Signed-off-by: u-kai <76635578+u-kai@users.noreply.github.com>
|
Is this resolved or still a problem? |
|
Sorry, it has already been resolved. |
/close |
|
@ivankatliarchuk: Closed this PR. DetailsIn response to this:
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. |
|
Sorry for the confusion. "Resolved" was referring to the code review comment being addressed, not the PR itself being resolved. I'll reopen this. |
|
/reopen |
|
@u-kai: Reopened this PR. DetailsIn response to this:
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 |
ivankatliarchuk
left a comment
There was a problem hiding this comment.
I think the change missing some links in PR title + debug logs or something.
High level. We have a gap - no end 2 end test that stitches together CheckEndpoint → dedupSource → AdjustEndpoints to show the full rejection path. The two unit tests exist, but their composition is not visible in unit tests.
There was a problem hiding this comment.
Are we cleaning up the providerSpecificAlias property in wrapper layer? This was just added in recent PR https://github.com/kubernetes-sigs/external-dns/pull/6021/changes
| expectedAaaa: nil, | ||
| }, | ||
| // TODO: fix For records other than A, AAAA, and CNAME, if an alias record is set, the alias record processing is not performed. This will be fixed in another PR. | ||
| { |
There was a problem hiding this comment.
I'm not sure. Maybe instead of removing test, actually provide a current code behaviour with changed name?
There was a problem hiding this comment.
You're right that this case can still exist from a unit test perspective.
However, in the current design, it's difficult for an alias record to be used with MX, since it's prevented at another layer, so I removed the test.
What kind of test name would you suggest if we keep it?
Co-authored-by: Ivan Ka <5395690+ivankatliarchuk@users.noreply.github.com>

What does it do?
This PR fixes incorrect behavior for record types that do not support AWS Alias records (e.g., MX, TXT, SRV, etc.).
Motivation
This work originated from the discussion here:
#5997 (comment)
When a ProviderSpecific property
alias=trueexists on record types that don't support alias records(like MX records):
evaluateTargetHealth=falsebeing addedReproduction
While this affects cases with incorrectly configured ProviderSpecific properties, I believe the behavior should
More