-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(aws): support alias=A and alias=AAAA to create single record type #5997
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
Changes from all commits
439c93b
e6789d6
82649ad
0a4595c
641bd3d
533d06c
c0d62b2
c65b5f5
33fea72
9d58543
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -252,8 +252,7 @@ func (im *TXTRegistry) Records(ctx context.Context) ([]*endpoint.Endpoint, error | |
| SetIdentifier: ep.SetIdentifier, | ||
| } | ||
|
|
||
| // AWS Alias records have "new" format encoded as type "cname" | ||
| if isAlias, found := ep.GetBoolProviderSpecificProperty(endpoint.ProviderSpecificAlias); found && isAlias && ep.RecordType == endpoint.RecordTypeA { | ||
| if shouldUseCNAMEForTxtRecord(ep) { | ||
| key.RecordType = endpoint.RecordTypeCNAME | ||
| } | ||
|
|
||
|
|
@@ -296,6 +295,13 @@ func (im *TXTRegistry) Records(ctx context.Context) ([]*endpoint.Endpoint, error | |
| return endpoints, nil | ||
| } | ||
|
|
||
| // shouldUseCNAMEForTxtRecord checks if the endpoint is an alias A record converted from CNAME. | ||
| // TXT ownership records use CNAME as the record type for such records. | ||
| func shouldUseCNAMEForTxtRecord(ep *endpoint.Endpoint) bool { | ||
| aliasType := ep.GetAliasProperty() | ||
| return (aliasType == endpoint.AliasTrue || aliasType == endpoint.AliasA) && ep.RecordType == endpoint.RecordTypeA | ||
| } | ||
|
Comment on lines
+300
to
+303
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @u-kai Thanks for the rebase. You have addressed many comments 👍 .
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mloiseleur
The CNAME encoding for alias A records may exist for backward compatibility: before #3910, alias records were represented as The alias AAAA record was never represented as CNAME, so its TXT record should use "AAAA" as the record type. |
||
|
|
||
| // generateTXTRecord generates TXT records in either both formats (old and new) or new format only, | ||
| // depending on the newFormatOnly configuration. The old format is maintained for backwards | ||
| // compatibility but can be disabled to reduce the number of DNS records. | ||
|
|
@@ -308,8 +314,8 @@ func (im *TXTRegistry) generateTXTRecordWithFilter(r *endpoint.Endpoint, filter | |
|
|
||
| // Always create new format record | ||
| recordType := r.RecordType | ||
| // AWS Alias records are encoded as type "cname" | ||
| if isAlias, found := r.GetBoolProviderSpecificProperty(endpoint.ProviderSpecificAlias); found && isAlias && recordType == endpoint.RecordTypeA { | ||
|
|
||
| if shouldUseCNAMEForTxtRecord(r) { | ||
| recordType = endpoint.RecordTypeCNAME | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing full example, hard to understand how to configure it.
example