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: Support Timeouts in ClientTrafficPolicy #2605

Merged
merged 18 commits into from
Feb 18, 2024
Merged

Conversation

yaelSchechter
Copy link
Contributor

@yaelSchechter yaelSchechter commented Feb 14, 2024

What this PR does / why we need it:
This PR will allow users to configure timeouts for client connections in the ClientTrafficPolicy.

This is implemented as a struct to allow future addition of related fields (such as request_headers_timeout and idle_timeout).

Naming rationale: requestReceivedTimeout is the envoy's request_timeout. This name indicates that the timeout includes the time it took for the upstream to receive the request.

Example:

spec:
  timeout:
    http:
      requestReceivedTimeout: 300s

Which issue(s) this PR fixes:
Fixes #2598

liorokman and others added 7 commits February 14, 2024 03:26
…r' header by default (envoyproxy#2585)

* Implement and update tests for the default header transformations.

Signed-off-by: Lior Okman <lior.okman@sap.com>

* Make 'gen-check' happy

Signed-off-by: Lior Okman <lior.okman@sap.com>

---------

Signed-off-by: Lior Okman <lior.okman@sap.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
Between envoyproxy#2585
&
envoyproxy#2581

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
* feat: downstream mTLS

Relates to envoyproxy#2483

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* configmap provider logic

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* gatewayapi translation

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* fix charts

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* tests

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

* lint

Signed-off-by: Arko Dasgupta <arko@tetrate.io>

---------

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
yaelSchechter and others added 2 commits February 14, 2024 12:57
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
Copy link
Contributor

@guydc guydc left a comment

Choose a reason for hiding this comment

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

Aligned with previous discussion in the community meeting.
LGTM.

Copy link
Contributor

@liorokman liorokman left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@davidalger davidalger left a comment

Choose a reason for hiding this comment

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

Perhaps this wasn't meant to be a finished work when pushed, but the added fields here aren't used anywhere and don't do anything. They need translation into XDS that's added to the listener as well as test coverage.

If an example is needed, I recently made a similar addition to the ClientTrafficPolicy type that might help point you to the right places: https://github.com/envoyproxy/gateway/pull/2535/files

Pay specific attention to internal/gatewayapi/clienttrafficpolicy.go and internal/ir/xds.go for translation as well as internal/xds/translator/listener.go where it's injected into HttpConnectionManager settings.

@liorokman
Copy link
Contributor

@davidalger features that change APIs are usually split into two PRs, the first one to agree upon the API itself and the second one to implement the feature. For example, #2534 and #2577 , or #2487 and #2492.

@davidalger
Copy link
Contributor

features that change APIs are usually split into two PRs, the first one to agree upon the API itself and the second one to implement the feature

How did I miss this? 😮 Nvm me then 🙈

@arkodg
Copy link
Contributor

arkodg commented Feb 14, 2024

thanks for pointing out the ideal workflow @liorokman (GH issue -> API PR -> Implementation PR) !
@davidalger thanks for proactively helping out other contributors !

Copy link

codecov bot commented Feb 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a5125bf) 63.41% compared to head (3fca4e7) 63.41%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2605   +/-   ##
=======================================
  Coverage   63.41%   63.41%           
=======================================
  Files         119      119           
  Lines       19227    19227           
=======================================
  Hits        12193    12193           
  Misses       6222     6222           
  Partials      812      812           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// Default: 300 seconds.
//
// +optional
RequestProcessTimeout *gwapiv1.Duration `json:"requestProcessTimeout,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

requestProceess doesnt convey the exact meaning of the knob imo
thoughts on processingRequestTimeout or even requestTimeout ?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for requestTimeout with a descriptive comment indicating something closer to what the docs describe:

The amount of time that Envoy will wait for the entire request to be received. The timer is activated when the request is initiated, and is disarmed when the last byte of the request is sent upstream OR when the response is initiated.

Alternately something like requestRecievedTimeout seems less ambiguous than any variation of process timeout and conveys the intent while differentiating this from the (upstream) request timeout which can be specified via timeouts.request on the HTTPRoute

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for requestRecievedTimeout

Copy link
Contributor

Choose a reason for hiding this comment

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

requestTimeout is slightly overloaded as gateway-api already defines a structure like timeout.request for httproutes.

I'm fine with requestRecievedTimeout or just requestTimeout if we're not concerned that this would be confusing (due to the other GW API field).

Copy link
Contributor Author

@yaelSchechter yaelSchechter Feb 15, 2024

Choose a reason for hiding this comment

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

Thanks for the feedback, I changed the field name to requestReceivedTimeout and added a more descriptive comment as @davidalger suggested.

yaelSchechter and others added 5 commits February 15, 2024 09:33
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
Signed-off-by: Yael Shechter <yael.shechter@sap.com>
@yaelSchechter
Copy link
Contributor Author

/retest

arkodg
arkodg previously approved these changes Feb 15, 2024
Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks !

Signed-off-by: Yael Shechter <yael.shechter@sap.com>
@arkodg arkodg requested a review from a team February 15, 2024 23:43
@yaelSchechter
Copy link
Contributor Author

/retest

@yaelSchechter
Copy link
Contributor Author

/retest

@zirain zirain merged commit 199f50c into envoyproxy:main Feb 18, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add timeouts support to clientTrafficPolicy
6 participants