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

Support wildcard records - Optional ability to replace the asterisk in generated registry TXT records with another string #1695

Conversation

dansimone
Copy link
Contributor

When using the txt registry, external-dns is not able to create wildcard records for many providers because the generated TXT records corresponding to the wildcard records are malformed: they contain an asterisk, but are not of the form "*.foo.bar". For example, this is the case with the Dyn provider.

A couple providers add special handling to deal with this, like aws.go. But rather than attempt to fix this in all providers, this PR adds an optional command line parameter that allows the asterisk in generated TXT records to be replaced with some arbitrary string. Setting this parameter (to any value) allows wildcard records to be created successfully for providers (like Dyn) where it doesn't work currently. This optional parameter is unset by default, meaning existing behavior is unchanged if it is not specified.

A couple of unit tests in txt_test.go has been updated to verify the new parameter.

dan.simone@oracle.com added 2 commits July 29, 2020 12:01
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 29, 2020
@k8s-ci-robot k8s-ci-robot requested review from linki and Raffo July 29, 2020 20:49
@dansimone
Copy link
Contributor Author

/assign @Raffo

@ericrrath
Copy link
Contributor

Seems like a good idea to me.

@seanmalloy
Copy link
Member

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 19, 2020
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 31, 2020
@seanmalloy
Copy link
Member

@dansimone please rebase and fix merge conflicts and we will try to get this reviewed. Thanks.

…wildcard-records

# Conflicts:
#	registry/txt.go
#	registry/txt_test.go
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 1, 2020
@seanmalloy
Copy link
Member

/assign

registry/txt.go Outdated
func newaffixNameMapper(prefix string, suffix string) affixNameMapper {
return affixNameMapper{prefix: strings.ToLower(prefix), suffix: strings.ToLower(suffix)}
func newaffixNameMapper(prefix string, suffix string, wildcardReplacement string) affixNameMapper {
return affixNameMapper{prefix: strings.ToLower(prefix), suffix: strings.ToLower(suffix), wildcardReplacement: wildcardReplacement}
Copy link
Member

@seanmalloy seanmalloy Sep 17, 2020

Choose a reason for hiding this comment

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

I'm curious ... why not also call strings.ToLower() for wildcardReplacement?

Copy link
Member

Choose a reason for hiding this comment

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

@dansimone please let me know what you think when you have some time. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seanmalloy sorry for the lag. Yes, I agree. Done in the latest commit.

@seanmalloy
Copy link
Member

@dansimone I left one inline comment.

Also, you mentioned that some providers(i.e. AWS) have code to already handle this case, but not all providers do. It would be good to clean up all of the providers in the future, so the code is cleaner. But I'm not saying that this needs to be done in this PR. We should probably create a list of providers that need updating, so we don't lose track of this.

@seanmalloy
Copy link
Member

/lgtm
/assign @Raffo @njuettner

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 26, 2020
@dansimone
Copy link
Contributor Author

@Raffo @njuettner please let me know when one of you has a chance to look at this.

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.

hey sorry that this PR was falling a bit through the cracks.
this looks good to me, maybe @Raffo you want to have another look?

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dansimone, njuettner, seanmalloy

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 9, 2020
@k8s-ci-robot k8s-ci-robot merged commit 9d2aaf0 into kubernetes-sigs:master Dec 9, 2020
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants