Backport of APIGW: Routes with duplicate parents should be invalid into release/1.15.x #16962
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport
This PR is auto-generated from #16926 to be assessed for backporting due to the inclusion of the label backport/1.15.
WARNING automatic cherry-pick of commits failed. Commits will require human attention.
The below text is copied from the body of the original PR.
Description
We currently don't validate that routes cannot have duplicate parents. This change introduces validations to ensure parents are unique according to the k8s gateway spec https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.CommonRouteSpec
Of note: we reached out to the k8's sig for clarification on some potential edge cases: kubernetes-sigs/gateway-api#1925
depending on the result of that this code may change in the future.
Testing & Reproduction steps
Run the
./start.sh
script from here https://github.com/jm96441n/consul-experiments/tree/main/vm/basic-api-gateway (this assumes you have run theconvoy-build
script at the root of the repo and have built a consul image locally). You will see the route be successfully added, rebuild the images with the changes in this branch and you will see the route fail to be entered.Links
k8s parent refs docs
PR Checklist
Overview of commits