Skip to content

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

Merged
andrewstucki merged 2 commits into
mainfrom
fix-up-virtual-resolvers
May 31, 2023
Merged

[API Gateway] Fix use of virtual resolvers in HTTPRoutes#17055
andrewstucki merged 2 commits into
mainfrom
fix-up-virtual-resolvers

Conversation

@andrewstucki
Copy link
Copy Markdown
Contributor

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 labels Apr 19, 2023
@andrewstucki andrewstucki requested review from a team and ishustava April 19, 2023 21:51
Comment thread .changelog/17055.txt
@@ -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
Copy Markdown
Member

@nathancoleman nathancoleman Apr 20, 2023

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
Copy Markdown
Contributor 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme/api-gw Track API gateway work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants