Skip to content

Conversation

gganley
Copy link

@gganley gganley commented Apr 10, 2025

Description

Currently if an HTTPRoute is attached to multiple Gateways whose hostnames overlap with each of the hostnames in the HTTPRoute, but at different lengths, it returns a Multivalue of the sorted gateway addresses. In my opinion in cases like this where the DNS entries will be CNAMEs or Alias records where Multivalue doesn't make sense (AFAIA) if there is a "more correct" answer that one should be used. So in this case the gateway that has the longer overlap with a given httproute hostname is used as the value for the DNS record.

Checklist

  • Unit tests updated
  • End user documentation updated

Basically this fixes a bug where if a single HTTPRoute is attached to
two different Gateways whose hostname matches a hostname on the
HTTPRoute but is a "longer match" whichever endpoint name that is
sorted first gets selected in cases where multivalue is not available
such as AWS alias record
Copy link

linux-foundation-easycla bot commented Apr 10, 2025

CLA Signed


The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Apr 10, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @gganley!

It looks like this is your first PR to kubernetes-sigs/external-dns 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/external-dns has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 10, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @gganley. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign szuecs for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Apr 10, 2025
@gganley gganley changed the title Longest suffix gateway hostname Route DNS entry uses longest matching suffix of all attached gateways Apr 10, 2025
@gganley gganley changed the title Route DNS entry uses longest matching suffix of all attached gateways *Route DNS entry uses longest matching suffix of all attached gateways Apr 10, 2025
@mloiseleur
Copy link
Collaborator

@gganley Would you please rename your PR following conventional commits ?

cc @abursavich for a first review

@abursavich
Copy link
Contributor

abursavich commented Apr 11, 2025

I understand your reasoning and agree that makes sense in most cases, but the user has explicitly attached the route to multiple gateways and listeners and we should respect that. I don't think what we decide is probably better in most cases should overrule what a user explicitly configured. That's a very high bar to clear.

@szuecs
Copy link
Contributor

szuecs commented Apr 13, 2025

In general we should wait on gateway-api people before we change anything on this right now.

@gganley
Copy link
Author

gganley commented Apr 21, 2025

@gganley Would you please rename your PR following conventional commits ?

cc @abursavich for a first review

Do you mean Conventional Commits? I was confused because I tried to read the contributing guide to the best of my abilities and didn't see anything referencing that but when I searched I found the issue you posted. Is this for automation reasons or just because it's something you/the team prefers?

Would that be something like BREAKING CHANGE: define preference order when multiple gateway hostnames match multiple route hostnames

@gganley
Copy link
Author

gganley commented Apr 21, 2025

I understand your reasoning and agree that makes sense in most cases, but the user has explicitly attached the route to multiple gateways and listeners and we should respect that. I don't think what we decide is probably better in most cases should overrule what a user explicitly configured. That's a very high bar to clear.

I think my logic changes can be updated to have the same IPs but in a different order based on the metrics I've laid out. In the specific case I use of k8s gateway API + AWS Route 53 (which creates alias) only the first entry in the multi answer is actually committed to DNS (I may have poor phrasing, sorry for that).

I could understand not wanting to break behavior even if the change "would make more sense", so would it make more sense to put this "new behavior" behind a major version or a configuration flag?

@gganley
Copy link
Author

gganley commented Apr 21, 2025

In general we should wait on gateway-api people before we change anything on this right now.

I've tried my best to read the gateway api spec and it doesn't seem like this is covered in the spec. The closest is the logic that decides between two HTTPRoutes, not the Gateways attached to a single HTTPRoute

In the event that multiple HTTPRoutes specify intersecting hostnames (e.g. overlapping wildcard matching and exact matching hostnames), precedence must be given to rules from the HTTPRoute with the largest number of: Characters in a matching non-wildcard hostname. Characters in a matching hostname.

@mloiseleur
Copy link
Collaborator

Would that be something like BREAKING CHANGE: define preference order when multiple gateway hostnames match multiple route hostnames

Something like

feat(gateway api)!:  preference order when multiple gateway hostnames match multiple route hostnames

@mloiseleur
Copy link
Collaborator

I could understand not wanting to break behavior even if the change "would make more sense", so would it make more sense to put this "new behavior" behind a major version or a configuration flag?

Nope. We will follow what the user explicitly configured and the Gateway API spec.
If this kind of change is accepted on Gateway API, then we can support it.

@gganley
Copy link
Author

gganley commented Apr 27, 2025

I could understand not wanting to break behavior even if the change "would make more sense", so would it make more sense to put this "new behavior" behind a major version or a configuration flag?

Nope. We will follow what the user explicitly configured and the Gateway API spec. If this kind of change is accepted on Gateway API, then we can support it.

Would reordering the gateway addresses rather than removing addresses be acceptable to accept without running by the spec team since the spec mentions nothing about order.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 15, 2025
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@mloiseleur
Copy link
Collaborator

mloiseleur commented May 15, 2025

If this kind of change is accepted on Gateway API, then we can support it.
Following this consensus among external-dns maintainers, I close this PR.

Feel free to re-open it or open a new one if you have a change accepted upstream, by Gateway API maintainers.
/close

@k8s-ci-robot
Copy link
Contributor

@mloiseleur: Closed this PR.

In response to this:

If this kind of change is accepted on Gateway API, then we can support it.
Following this consensus among the maintainers, I close this PR.

Feel free to re-open it or open a new one if you have a change accepted upstream, by Gateway API maintainers.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants