Skip to content

NET-5115 Add retry + timeout filters for api-gateway#18324

Merged
sarahalsmiller merged 2 commits intomainfrom
NET-4889-consul-initial-work
Aug 8, 2023
Merged

NET-5115 Add retry + timeout filters for api-gateway#18324
sarahalsmiller merged 2 commits intomainfrom
NET-4889-consul-initial-work

Conversation

@sarahalsmiller
Copy link
Copy Markdown
Member

@sarahalsmiller sarahalsmiller commented Jul 28, 2023

Description

Initial updates to allow the API Gateway from the consul core side to allow API Gateway HTTPRoutes to have configurable retries and timeouts. There will be follow up work in consul-k8s.

Expecting some feedback/updates on the name scheme, but this PR should contain everything it needs to make this functional on the consul side.

Testing & Reproduction steps

  • Run XDS resource test package and note that the envoy configuration is set correctly

Links

https://hashicorp.atlassian.net/browse/NET-5115

PR Checklist

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

@sarahalsmiller sarahalsmiller requested a review from a team July 28, 2023 19:14
@github-actions github-actions bot added theme/api Relating to the HTTP API interface theme/envoy/xds Related to Envoy support labels Jul 28, 2023
@sarahalsmiller sarahalsmiller changed the title [Net 4889] consul initial work NET-5115 consul initial work Jul 31, 2023
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

minor: do we want postfix these names with Filter to make it clear they're filters on a route or do you think that's too verbose/not really necessary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The reason I didn't is because the filter types on the gateway spec didn't have the filter suffix. If its something we agree we should add I don't have strong feelings about it.

Copy link
Copy Markdown
Member

@nathancoleman nathancoleman Jul 31, 2023

Choose a reason for hiding this comment

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

I'm in favor of the Filter postfix, looking at the naming conventions in the gateway-api repo over here for inspiration

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm in favor of the Filter suffix as well, and I think we can either drop HTTPRoute at the beginning in its entirety or just make it HTTP so either something like:

  • HTTPTimeoutFilter or
  • TimeoutFilter (if we want to re-use this on say GRPC protocols in the future)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We landed on HTTPRoute prefix for the corresponding CRD over in consul-k8s so that the names are self-documenting. Things here in the consul repo don't have to match since we already have some filter naming conventions without the prefix.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Changed it to TimeoutFilter and RetryFilter, and the CRD work will be named HTTPRouteTimeoutFilter and HTTPRouteRetryFilter 👍

@sarahalsmiller sarahalsmiller force-pushed the NET-4889-consul-initial-work branch from 7a2e068 to 2329e8b Compare July 31, 2023 19:05
Copy link
Copy Markdown
Member

@nathancoleman nathancoleman left a comment

Choose a reason for hiding this comment

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

Nice work! Just sharing some thoughts here

@sarahalsmiller sarahalsmiller marked this pull request as ready for review August 1, 2023 20:23
@sarahalsmiller sarahalsmiller force-pushed the NET-4889-consul-initial-work branch 4 times, most recently from 8a996c1 to cf2bf7f Compare August 2, 2023 16:02
@sarahalsmiller sarahalsmiller requested a review from a team as a code owner August 8, 2023 19:11
@sarahalsmiller sarahalsmiller force-pushed the NET-4889-consul-initial-work branch from b4783b4 to 17bd17b Compare August 8, 2023 19:16
@nathancoleman nathancoleman changed the title NET-5115 consul initial work NET-5115 Add retry + timeout filters for api-gateway Aug 8, 2023
NumRetries *uint32
RetryOn []string
RetryOnStatusCodes []uint32
RetryOnConnectFailure *bool
Copy link
Copy Markdown
Member

@nathancoleman nathancoleman Aug 8, 2023

Choose a reason for hiding this comment

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

I suspect we can actually remove RetryOnConnectFailure based on this code + comment pointing out that there are two ways of getting "connect-failure" added to the RetryOn list. The standalone field is referred to as "legacy".

I'm fine leaving for now since our code is already built to handle both, but I'd like to discuss with the team prior to release whether we want to drop the "legacy" option from our API surface.