-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Registry record type #2157
Registry record type #2157
Conversation
/assign njuettner |
240dcc9
to
829e8cb
Compare
registry/txt.go
Outdated
if len(DNSName) < 2 { | ||
return pr.prefix + recordT + DNSName[0] + pr.suffix | ||
} | ||
return pr.prefix + recordT + DNSName[0] + pr.suffix + "." + DNSName[1] |
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.
Hierarchically, I think it would make more sense to have the record type precede the prefix. I personally would like to use:
<recordType><prefix><endpointDNSName>
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.
@haslersn amended
9426904
to
d3caadd
Compare
@k0da Would it be a good thing to make the separator configurable or just go for a "-" or "_"? |
@jgrumboe When adding the record type before My preference would be to (have the option to) configure it similar to the naming scheme of today's SRV records and DKIM records. |
@haslersn You're right. (I'm currently looking from a mobile, so it was just a quick look.) Sorry, i don't understand what you mean with SRV and DKIM records. |
Similarly, I'd like to use the naming scheme |
Would be already possible if, for example, you set txt-prefix to "._heritage." and record type will be added without delimiter. You would need to take care yourself in txt-prefix to set a delimiter of your choice for the record type, as in my example it's the first "." in front of "_heritage.". Not much adoption in code needed as getting rid of hard-coded delimiter. This would also need no separate configuration option. What do you think? |
@jgrumboe That's pretty much what I proposed. You just added that the type is added to the suffix instead, if a suffix is set. |
@haslersn @jgrumboe if prefix is not set, and delimeter is not there, record name will be quite ugly out of the box. That would require to set prefix as a delimeter. I don't like an idea of dancing around suffix prefix. Intention is to change default TXT record name from to . Then if suffix or prefix are configured, entry will be changed accordingly. Having record type in the beginning gives a clear context which record it belongs to. |
@k0da I agree that you would need some kind of delimiter set without any prefix or suffix set. Otherwise, it will look not pleasant, as you said. "dancing around suffix and prefix" is inevitable, I think because that's why the suffix was introduced: to keep the original name in front and suffix it with registry related information. The record type is just another registry related information, in my opinion. |
@jgrumboe My point is record type should be part of the initial name. And them prefixed, suffixed as user wants. Since I'm not suffix/prefix user, I'd like to gather some feedback from users of those, how it is used and what is the primary usecase. Adding record type is a functional change required to open a posibility to manage multiple record types, IIUC prefix/suffix is more decorator thingie. |
@k0da I wouldn't say that prefix/suffix is decoration. In use-cases where you want external-dns to manage CNAMEs a prefix or suffix is a must as otherwise the registry records wouldn't get created because of conflicts. I understand that making the record type part of the record name is mitigating this already, but my feedback is that I would like to see this configurable for the user as it would feel like an "automated set" prefix. My use case with suffix was to make life easier for DNS management people, which are managing through a UI (like Infoblox) and have related records listed next to each other in alphabetical order. Others might prefer to have the registry records "hidden" from first sight within some subdomain. |
@jgrumboe so your case would be |
@k0da No, I'm the suffix fan-boy :) The suggested implementation in this PR would be Just a very different idea: What about introducing a |
@jgrumboe I see your point now. Right now, resulting name is |
Sorry, "smashing" your PR wasn't my intention. And what about this kind of templating variable? Wouldn't that be fairly easy to implement and help your case of multiple registry records? |
@jgrumboe we can't use template here: https://github.com/kubernetes-sigs/external-dns/blob/master/registry/txt.go#L246 |
I'd love the template (
Why not? The function uses If that's not possible, then we need to stick to something like @jgrumboe and I proposed.
Why prescribe the delimiter |
@haslersn introducing a template would neglate suffix prefix and it would be something more like unique identifier. I don't see quick and easy way parse TXT record into endpoint name from given template. Mind to provide dummy snippet? @jgrumboe @haslersn you guys trying to make recordtype as part of either prefix or suffix, while it should be part of name, and then prefixed or suffixed. this way we can drop prefix/suffix and then parse it back to endpoint name. |
@k0da Here's a snippet without suffix support: func (pr affixNameMapper) toEndpointName(txtDNSName string) string {
lowerDNSName := strings.ToLower(txtDNSName)
for _, type := range supportedTypes {
instantiatedPrefix = strings.ReplaceAll(pr.prefix, "%{record_type}", type)
if strings.HasPrefix(lowerDNSName, instantiatedPrefix) {
return strings.TrimPrefix(lowerDNSName, instantiatedPrefix)
}
}
return ""
} However, (as soon as IPv6 support is introduced) there would a potential problem if one puts
would result in the same name in the TXT registry. |
Done |
@Raffo ^^ |
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.
@k0da I added a few more comments, thank you for you updates.
I have also another request: can you add additional comments in the code on how to remove all the parts that we will have to eventually remove once the migration is not done. I want to make sure that we do not end up with more code than needed on a long term.
Something is off with the linter 😞 |
d1caadf
to
d3e96cf
Compare
@Raffo review points has been addressed. Please take a look |
d3e96cf
to
32d748b
Compare
@Raffo re linter issues. Looks like something pulls go 1.18 https://github.com/kubernetes-sigs/external-dns/runs/5849391653?check_suite_focus=true#step:2:11 |
@k0da yeah I saw that something bumped to go 1.18 so that’s gonna be failures for all builds 😭 I will go and check what’s wrong 🕵️ |
You can merge master in and it should fix the linting issue. |
In order to track multiple record types with the same name, lets migrate to new format, were record name contains record type in it. Signed-off-by: Dinar Valeev <dinar.valeev@absa.africa>
32d748b
to
25c7cb2
Compare
@Raffo rebased, tests and linter are green |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: k0da, Raffo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
When upgrading to 0.12.0 from 0.10.2 I think it is this change that causes errors like
This is on AWS using Route53. Is there a setting to avoid this error? |
Hi, Is it possible to revert this breaking change to resolve #2157 ? |
Description
Add additional txt record with record type marker
Fixes #1923
Checklist