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

[API Gateway] Fix use of virtual resolvers in HTTPRoutes #17055

Merged
merged 2 commits into from May 31, 2023

Conversation

andrewstucki
Copy link
Member

Description

I realized that we were actually improperly munging http route references in synthesized discovery chains for API gateways. What this meant was that when using an service resolver to create a virtual service referenced by an HTTPRoute we wind up writing in the wrong target cluster for a routing rule. This results in the gateway returning "no healthy upstreams".

This change takes into account when the target is just a virtual service created by a service-resolver.

Testing & Reproduction steps

Unit tested and manually verified with the following configuration entries and a mesh-federated Consul setup:

  1. TCP Routes
Kind = "tcp-route"
Name = "api-gateway-route"
Services = [
  {
    Name = "tcp-dc-2"
  }
]

Parents = [
  {
    Name = "api"
  }
]
Kind = "api-gateway"
Name = "api"
Listeners = [
  {
    Name     = "listener-one"
    Port     = ...
    Protocol = "tcp"
  }
]
Kind = "service-resolver"
Name = "tcp-dc-2"
Redirect {
  Service    = "tcp-2"
  Datacenter = "dc2"
}
  1. HTTPRoutes
Kind = "http-route"
Name = "api-gateway-route"
Services = [
  {
    Name = "http-dc-2"
  }
]

Parents = [
  {
    Name = "api"
  }
]
Kind = "api-gateway"
Name = "api"
Listeners = [
  {
    Name     = "listener-one"
    Port     = ...
    Protocol = "http"
  }
]
Kind = "service-resolver"
Name = "http-dc-2"
Redirect {
  Service    = "http-2"
  Datacenter = "dc2"
}

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

@andrewstucki andrewstucki added theme/api-gw Track API gateway work backport/1.15 Changes are backported to 1.15 labels Apr 19, 2023
@andrewstucki andrewstucki requested review from ishustava and a team April 19, 2023 21:51
@@ -0,0 +1,3 @@
```release-note:bug
gateways: Fix an bug where targeting a virtual service defined by a service-resolver was broken for HTTPRoutes.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
gateways: Fix an bug where targeting a virtual service defined by a service-resolver was broken for HTTPRoutes.
gateways: Fix a bug where targeting a virtual service defined by a service-resolver was broken for http-routes.

@andrewstucki
Copy link
Member Author

merging this as-is for now so it can get backported for the 1.15.3 release, but will circle back to add additional integration tests later

@andrewstucki andrewstucki merged commit ca12ce9 into main May 31, 2023
121 checks passed
@andrewstucki andrewstucki deleted the fix-up-virtual-resolvers branch May 31, 2023 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.15 Changes are backported to 1.15 theme/api-gw Track API gateway work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants