-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat(txt-registry): add option to use only new format #4946
base: master
Are you sure you want to change the base?
Changes from all commits
0d56712
c7154c9
7c22a03
fd9091a
64a1b4d
4c2e124
438d565
8937026
ab3dfe6
299d087
a1d64bd
78e1ffc
0bcd0e3
07e4c3e
c8d85a7
5a849a7
dafa734
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 |
---|---|---|
|
@@ -3,6 +3,35 @@ | |
The TXT registry is the default registry. | ||
It stores DNS record metadata in TXT records, using the same provider. | ||
|
||
## Record Format Options | ||
The TXT registry supports two formats for storing DNS record metadata: | ||
- Legacy format: Creates a TXT record without record type information | ||
- New format: Creates a TXT record with record type information (e.g., 'a-' prefix for A records) | ||
|
||
By default, the TXT registry creates records in both formats for backwards compatibility. You can configure it to use only the new format by using the `--txt-new-format-only` flag. This reduces the number of TXT records created, which can be helpful when working with provider-specific record limits. | ||
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. Can we add a bit more information about this behaviour as well? e.g. why external-dns creates two records 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. I don't have the history of why there are 2 formats, but would be glad to add some more text about it. We just reached a point in my team at work where we would like to get rid of our duplicate TXT records in all of our DNS zones. |
||
|
||
Note: The following record types always use only the new format regardless of this setting: | ||
- AAAA records | ||
- Encrypted TXT records (when using `--txt-encrypt-enabled`) | ||
|
||
Example: | ||
```sh | ||
# Default behavior - creates both formats | ||
external-dns --provider=aws --source=ingress --managed-record-types=A,TXT | ||
|
||
# Only create new format records (alongside other required flags) | ||
external-dns --provider=aws --source=ingress --managed-record-types=A,TXT --txt-new-format-only | ||
``` | ||
The `--txt-new-format-only` flag should be used in addition to your existing external-dns configuration flags. It does not implicitly configure TXT record handling - you still need to specify `--managed-record-types=TXT` if you want external-dns to manage TXT records. | ||
|
||
### Migration to New Format Only | ||
When transitioning from dual-format to new-format-only records: | ||
- Ensure all your `external-dns` instances support the new format | ||
- Enable the `--txt-new-format-only` flag on your external-dns instances | ||
Manually clean up any existing legacy format TXT records from your DNS provider | ||
|
||
Note: `external-dns` will not automatically remove legacy format records when switching to new-format-only mode. You'll need to clean up the old records manually if desired. | ||
|
||
## Prefixes and Suffixes | ||
|
||
In order to avoid having the registry TXT records collide with | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,7 @@ type Config struct { | |
TXTSuffix string | ||
TXTEncryptEnabled bool | ||
TXTEncryptAESKey string `secure:"yes"` | ||
TXTNewFormatOnly bool | ||
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. would it be possible to update 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. Added tests for the new flag now |
||
Interval time.Duration | ||
MinEventSyncInterval time.Duration | ||
Once bool | ||
|
@@ -299,6 +300,7 @@ var defaultConfig = &Config{ | |
MinEventSyncInterval: 5 * time.Second, | ||
TXTEncryptEnabled: false, | ||
TXTEncryptAESKey: "", | ||
TXTNewFormatOnly: false, | ||
Interval: time.Minute, | ||
Once: false, | ||
DryRun: false, | ||
|
@@ -591,6 +593,7 @@ func App(cfg *Config) *kingpin.Application { | |
app.Flag("txt-wildcard-replacement", "When using the TXT registry, a custom string that's used instead of an asterisk for TXT records corresponding to wildcard DNS records (optional)").Default(defaultConfig.TXTWildcardReplacement).StringVar(&cfg.TXTWildcardReplacement) | ||
app.Flag("txt-encrypt-enabled", "When using the TXT registry, set if TXT records should be encrypted before stored (default: disabled)").BoolVar(&cfg.TXTEncryptEnabled) | ||
app.Flag("txt-encrypt-aes-key", "When using the TXT registry, set TXT record decryption and encryption 32 byte aes key (required when --txt-encrypt=true)").Default(defaultConfig.TXTEncryptAESKey).StringVar(&cfg.TXTEncryptAESKey) | ||
app.Flag("txt-new-format-only", "When using the TXT registry, only use new format records which include record type information (e.g., prefix: 'a-'). Reduces number of TXT records (default: disabled)").BoolVar(&cfg.TXTNewFormatOnly) | ||
app.Flag("dynamodb-region", "When using the DynamoDB registry, the AWS region of the DynamoDB table (optional)").Default(cfg.AWSDynamoDBRegion).StringVar(&cfg.AWSDynamoDBRegion) | ||
app.Flag("dynamodb-table", "When using the DynamoDB registry, the name of the DynamoDB table (default: \"external-dns\")").Default(defaultConfig.AWSDynamoDBTable).StringVar(&cfg.AWSDynamoDBTable) | ||
|
||
|
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.
Could you include a subsection on how to handle the migration from two records to a single record? Specifically, what are the steps involved in this consolidation, and will the external DNS automatically delete the old records or will manual cleanup be necessary?
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.
Right now i haven't thought of any automatic cleanup, so for now it would be a manual cleanup for the old format
TXT
records.Is that an okay approach, or would you like it to happen automatically?
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.
Mentioning this in the documentation likely is enough.
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.
Added an extra section describing a manual migration flow.