Skip to content

HTTPRoute timeout #2013

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

Merged
merged 11 commits into from
Sep 12, 2023
Merged

HTTPRoute timeout #2013

merged 11 commits into from
Sep 12, 2023

Conversation

SRodi
Copy link
Member

@SRodi SRodi commented May 12, 2023

What type of PR is this?

HTTPRoute Timeouts

  • update HTTPRoute interfaces according to latest proposal in GEP-1742
  • add Duration type as per GEP-2257
  • include Request and BackendRequest in HTTPRouteTimeouts
  • add validation for HTTPRouteTimeouts
  • add unit tests in httproute_test.go
  • relates to GEP-1742: HTTPRoute Timeouts API #1997

Relates to:

What this PR does / why we need it:
POC for HTTPRout timeout proposal

Which issue(s) this PR fixes:

Relates to #1742

Does this PR introduce a user-facing change?:

New fields have been added to configure timeouts on `HTTPRoute` rules:

- `rules.timeouts.request`: to specify a timeout for responding to client HTTP requests
- `rules.timeouts.backendRequest`: to specify a timeout for individual requests from the gateway to a backend service

See [GEP-1472](https://gateway-api.sigs.k8s.io/geps/gep-1742/) for more information.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 12, 2023
@SRodi SRodi marked this pull request as draft May 12, 2023 12:17
@k8s-ci-robot
Copy link
Contributor

Welcome @SRodi!

It looks like this is your first PR to kubernetes-sigs/gateway-api 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/gateway-api has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @SRodi. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 12, 2023
@k8s-ci-robot k8s-ci-robot requested a review from bowei May 12, 2023 12:17
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 12, 2023
@k8s-ci-robot k8s-ci-robot requested a review from youngnick May 12, 2023 12:17
@SRodi SRodi marked this pull request as ready for review May 15, 2023 19:33
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 15, 2023
@k8s-ci-robot k8s-ci-robot requested a review from shaneutt May 15, 2023 19:33
@SRodi SRodi requested review from sunjayBhatia and frankbu May 15, 2023 19:38
@SRodi SRodi marked this pull request as draft May 15, 2023 19:52
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 15, 2023
@frankbu
Copy link
Contributor

frankbu commented May 18, 2023

@SRodi Can you also add a check for timeouts in the validator, e.g., check the value is >= 1ms?

func ValidateHTTPRouteSpec(spec *gatewayv1b1.HTTPRouteSpec, path *field.Path) field.ErrorList {

@SRodi SRodi requested a review from frankbu May 18, 2023 21:00
@SRodi SRodi force-pushed the httproute-timeout branch from 2fad26d to 05f32da Compare May 19, 2023 07:13
@k8s-ci-robot k8s-ci-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label May 19, 2023
@SRodi SRodi requested a review from frankbu May 19, 2023 07:17
Copy link
Contributor

@kflynn kflynn left a comment

Choose a reason for hiding this comment

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

I had a couple of small questions – many thanks for doing this, @SRodi! 🙂

@SRodi SRodi requested a review from kflynn September 8, 2023 15:28
// Specifying a zero value such as "0s" is interpreted as no timeout.
//
// +kubebuilder:validation:XValidation:message="backendRequest timeout cannot be longer than request timeout",rule="!(has(self.request) && has(self.backendRequest) && duration(self.request) != duration('0s') && duration(self.backendRequest) > duration(self.request))"
type HTTPRouteTimeouts struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we also need type HTTPRouteTimeouts = v1beta1.HTTPRouteTimeouts in apis/v1alpha2/httproute_types.go?

Copy link
Member

Choose a reason for hiding this comment

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

Let's leave it out. We're moving away from v1alpha2 types (they're no longer served in v0.8.0 CRDs) and I'd expect most/all implementations to have moved away from them before we hit v1.0.0. I haven't had time to figure out if we should leave v1alpha2 type definitions in place for one more release or drop them in v1.0, but in either case, I think I'd rather avoid adding anything new to them.

@frankbu
Copy link
Contributor

frankbu commented Sep 8, 2023

Looks like the cel tests are failing?

I'm wondering why pull-gateway-api-verify says "Job succedded" even though several tests have failed?

^^^ @robscott any idea what's wrong here?

@robscott
Copy link
Member

robscott commented Sep 8, 2023

@frankbu good catch, my best guess would be that #2362 may have introduced a regression here. Will put a hold on this until we can figure it out.

/hold

@frankbu
Copy link
Contributor

frankbu commented Sep 8, 2023

Looks like the cel tests are failing?

Does config/crd/standard/gateway.networking.k8s.io_httproutes.yaml need to be regenerated to include the timeouts as well?

@SRodi
Copy link
Member Author

SRodi commented Sep 8, 2023

@frankbu @robscott as mentioned here #2013 (comment) the CEL tests are failing on standard channel but passing on experimental. What should I do about that ?

@robscott
Copy link
Member

robscott commented Sep 8, 2023

@frankbu @robscott as mentioned here #2013 (comment) the CEL tests are failing on standard channel but passing on experimental. What should I do about that ?

@SRodi you want to add the tests to this file instead: https://github.com/kubernetes-sigs/gateway-api/blob/main/pkg/test/cel/httproute_experimental_test.go. The test script actually loops through the channels, and installs CRDs and runs tests specifically for that channel (using build tags). Here's the actual test command that's being run: https://github.com/kubernetes-sigs/gateway-api/blob/main/hack/verify-crds-kind.sh#L63.

Does config/crd/standard/gateway.networking.k8s.io_httproutes.yaml need to be regenerated to include the timeouts as well?

Nope, experimental features are intentionally excluded from standard channel CRDs, so that part of this PR is working as intended.

@SRodi
Copy link
Member Author

SRodi commented Sep 8, 2023

All tests are passing after moving them to httproute_experimental_test.go - thanks for clarifying this @robscott

Is there anything else I should add to this PR?

@youngnick
Copy link
Contributor

This PR is just on hold while I check the changes I introduced in #2362 - once I've either fixed any problems or confirmed it's not actually a problem, we can proceed. Until then, please sit tight.

@robscott
Copy link
Member

Fixes in #2362 were great, looks like we can remove the hold on this one.

/hold cancel
/approve

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 11, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adleong, frankbu, robscott, SRodi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 11, 2023
Copy link
Contributor

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

/lgtm

Nice work @SRodi

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 12, 2023
@k8s-ci-robot k8s-ci-robot merged commit f77919e into kubernetes-sigs:main Sep 12, 2023
This was referenced Sep 14, 2023
SRodi added a commit to SRodi/istio that referenced this pull request Sep 14, 2023
@SRodi SRodi mentioned this pull request Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.