fix(kuma-cp): skip creating MeshGateways without proper attachmenet #4011
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.
Summary
In http route controller we convert API Gateway's HTTPRoute to Kuma's MeshGatewayRoute.
HTTP route looks like this
We can only consider HTTPRoute valid if it has a valid
parentsRef
. Seecase attachment.Allowed:
in this file.The problem was that I used this HTTPRoute with this Gateway
HTTPRoute cannot be attached to this Gateway because it's in different namespace. The attachment was computed correctly
case attachment.NotPermitted:
. However, we successfully converted MeshGatewayRoute anyways, but without selectors. Then, we were trying to create it which resulted in error because we have static validators on empty selectors in MeshGatewayRoute.Solution?
Only convert when there is an attachment - an extra if I added
Bonus notes:
To reference HTTPRoute cross namespace I had to add this
Issues resolved
No issues reported. I noticed this when I was testing Gateway API.
Documentation
No docs.
Testing
No tests yet as this is bigger story for Gateway API :(
Backwards compatibility
- [ ] UpdateUPGRADE.md
with any steps users will need to take when upgrading.- [ ] Addbackport-to-stable
label if the code follows our backporting policy