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

Correct format of SRV record for NodePort #1914

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

vanekjar
Copy link
Contributor

@vanekjar vanekjar commented Jan 9, 2021

Description

Currently, the NodePort extraction results in an SRV record with the DNS name in the following format:

_31569._tcp.nginx.my-external-dns-test.com 0 IN SRV  0 50 31569 nginx.my-external-dns-test.com

Please note that the first part of the DNS name is the port. That defeats the purpose of the SRV record since the client needs to know the port number upfront to query for the record to "learn" the port again from the DNS server.

DNS RFC specifies that the SRV record should be in the following format (see https://en.wikipedia.org/wiki/SRV_record):

_service._proto.name. TTL class SRV priority weight port target.

For that reason I replaced the port in the DNS name with the K8s Service name resulting in records with this format:

_nginx._tcp.nginx.my-external-dns-test.com 0 IN SRV  0 50 31569 nginx.my-external-dns-test.com

Checklist

  • Unit tests updated
  • [ no related doc ] End user documentation updated

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 9, 2021
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 9, 2021
@vanekjar
Copy link
Contributor Author

vanekjar commented Jan 9, 2021

@grimmy, please can you take a look if this change doesn't brake anything regarding NodePort support?

@grimmy
Copy link
Contributor

grimmy commented Jan 9, 2021

@vanekjar as previously stated, I no longer have access to the cluster where I originally added the node port srv record support for. That said this looks fine, but I'm sure a bunch of people would appreciate if you could fix #637 in this as well.

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.

This would make sense to me, however I don't know if this breaks current usage? What if you have already existing SRV records with port usage for the record?

It might be worth mentioning that people might be surprised upgrading external-dns at some point.

I'd like to hear the opinion of the community if this would be ok or if we need to have a workaround when updating external-dns.

@vanekjar
Copy link
Contributor Author

I believe we're safe in terms of backwards compatibility. SRV records don't work so far, so there shouldn't be an issue with existing records (covered in PR #1890)

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.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 27, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: njuettner, vanekjar

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 Jan 27, 2021
@k8s-ci-robot k8s-ci-robot merged commit fce02fb into kubernetes-sigs:master Jan 27, 2021
@vanekjar vanekjar deleted the SRV-fix-port branch January 27, 2021 17:05
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants