Skip to content

configuration: Add support for Envoys MaxStreamDuration configuration #6895

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apis/projectcontour/v1/httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,12 @@ type TimeoutPolicy struct {
// +optional
// +kubebuilder:validation:Pattern=`^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$`
IdleConnection string `json:"idleConnection,omitempty"`

// Maximum allowed duration a streaming request can run for.
// If not supplied, the global setting is used.
// +optional
// +kubebuilder:validation:Pattern=`^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$`
MaxStreamDuration string `json:"maxStreamDuration,omitempty"`
}

// RetryOn is a string type alias with validation to ensure that the value is valid.
Expand Down
9 changes: 9 additions & 0 deletions apis/projectcontour/v1alpha1/contourconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,15 @@ type TimeoutParameters struct {
// +optional
MaxConnectionDuration *string `json:"maxConnectionDuration,omitempty"`

// MaxStreamDuration defines the maximum duration a HTTP stream is kept alive.
// The stream will be reset if the time limit is reached. Omit or set to "infinity" for
// no max duration.
//
// See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-stream-duration
// for more information.
// +optional
MaxStreamDuration *string `json:"maxStreamDuration,omitempty"`

// DelayedCloseTimeout defines how long envoy will wait, once connection
// close processing has been initiated, for the downstream peer to close
// the connection before Envoy closes the socket associated with the connection.
Expand Down
5 changes: 5 additions & 0 deletions apis/projectcontour/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions changelogs/unreleased/6895-nickburgin-small.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for Envoys MaxStreamDuration setting Globally and on Routes
3 changes: 3 additions & 0 deletions cmd/contour/servecontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ func (ctx *serveContext) convertToContourConfigurationSpec() contour_v1alpha1.Co
if len(ctx.Config.Timeouts.MaxConnectionDuration) > 0 {
timeoutParams.MaxConnectionDuration = ptr.To(ctx.Config.Timeouts.MaxConnectionDuration)
}
if len(ctx.Config.Timeouts.MaxStreamDuration) > 0 {
timeoutParams.MaxStreamDuration = ptr.To(ctx.Config.Timeouts.MaxStreamDuration)
}
if len(ctx.Config.Timeouts.DelayedCloseTimeout) > 0 {
timeoutParams.DelayedCloseTimeout = ptr.To(ctx.Config.Timeouts.DelayedCloseTimeout)
}
Expand Down
28 changes: 28 additions & 0 deletions cmd/contour/servecontext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,34 @@ func TestConvertServeContext(t *testing.T) {
return cfg
},
},
"timeout parameters": {
getServeContext: func(ctx *serveContext) *serveContext {
ctx.Config.Timeouts = config.TimeoutParameters{
RequestTimeout: "1",
ConnectionIdleTimeout: "2",
StreamIdleTimeout: "3",
MaxConnectionDuration: "4",
MaxStreamDuration: "5",
DelayedCloseTimeout: "6",
ConnectionShutdownGracePeriod: "7",
ConnectTimeout: "8",
}
return ctx
},
getContourConfiguration: func(cfg contour_v1alpha1.ContourConfigurationSpec) contour_v1alpha1.ContourConfigurationSpec {
cfg.Envoy.Timeouts = &contour_v1alpha1.TimeoutParameters{
RequestTimeout: ptr.To("1"),
ConnectionIdleTimeout: ptr.To("2"),
StreamIdleTimeout: ptr.To("3"),
MaxConnectionDuration: ptr.To("4"),
MaxStreamDuration: ptr.To("5"),
DelayedCloseTimeout: ptr.To("6"),
ConnectionShutdownGracePeriod: ptr.To("7"),
ConnectTimeout: ptr.To("8"),
}
return cfg
},
},
"access log": {
getServeContext: func(ctx *serveContext) *serveContext {
ctx.Config.AccessLogFormat = config.JSONAccessLog
Expand Down
28 changes: 28 additions & 0 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,14 @@ spec:
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-connection-duration
for more information.
type: string
maxStreamDuration:
description: |-
MaxStreamDuration defines the maximum duration a HTTP stream is kept alive.
The stream will be reset if the time limit is reached. Omit or set to "infinity" for
no max duration.
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-stream-duration
for more information.
type: string
requestTimeout:
description: |-
RequestTimeout sets the client request timeout globally for Contour. Note that
Expand Down Expand Up @@ -4399,6 +4407,14 @@ spec:
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-connection-duration
for more information.
type: string
maxStreamDuration:
description: |-
MaxStreamDuration defines the maximum duration a HTTP stream is kept alive.
The stream will be reset if the time limit is reached. Omit or set to "infinity" for
no max duration.
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-stream-duration
for more information.
type: string
requestTimeout:
description: |-
RequestTimeout sets the client request timeout globally for Contour. Note that
Expand Down Expand Up @@ -5274,6 +5290,12 @@ spec:
If not supplied, Envoy's default value of 1h applies.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
maxStreamDuration:
description: |-
Maximum allowed duration a streaming request can run for.
If not supplied, the global setting is used.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
response:
description: |-
Timeout for receiving a response from the server after processing a request from client.
Expand Down Expand Up @@ -7021,6 +7043,12 @@ spec:
If not supplied, Envoy's default value of 1h applies.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
maxStreamDuration:
description: |-
Maximum allowed duration a streaming request can run for.
If not supplied, the global setting is used.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
response:
description: |-
Timeout for receiving a response from the server after processing a request from client.
Expand Down
28 changes: 28 additions & 0 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,14 @@ spec:
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-connection-duration
for more information.
type: string
maxStreamDuration:
description: |-
MaxStreamDuration defines the maximum duration a HTTP stream is kept alive.
The stream will be reset if the time limit is reached. Omit or set to "infinity" for
no max duration.
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-stream-duration
for more information.
type: string
requestTimeout:
description: |-
RequestTimeout sets the client request timeout globally for Contour. Note that
Expand Down Expand Up @@ -4614,6 +4622,14 @@ spec:
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-connection-duration
for more information.
type: string
maxStreamDuration:
description: |-
MaxStreamDuration defines the maximum duration a HTTP stream is kept alive.
The stream will be reset if the time limit is reached. Omit or set to "infinity" for
no max duration.
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-stream-duration
for more information.
type: string
requestTimeout:
description: |-
RequestTimeout sets the client request timeout globally for Contour. Note that
Expand Down Expand Up @@ -5489,6 +5505,12 @@ spec:
If not supplied, Envoy's default value of 1h applies.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
maxStreamDuration:
description: |-
Maximum allowed duration a streaming request can run for.
If not supplied, the global setting is used.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
response:
description: |-
Timeout for receiving a response from the server after processing a request from client.
Expand Down Expand Up @@ -7236,6 +7258,12 @@ spec:
If not supplied, Envoy's default value of 1h applies.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
maxStreamDuration:
description: |-
Maximum allowed duration a streaming request can run for.
If not supplied, the global setting is used.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
response:
description: |-
Timeout for receiving a response from the server after processing a request from client.
Expand Down
28 changes: 28 additions & 0 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,14 @@ spec:
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-connection-duration
for more information.
type: string
maxStreamDuration:
description: |-
MaxStreamDuration defines the maximum duration a HTTP stream is kept alive.
The stream will be reset if the time limit is reached. Omit or set to "infinity" for
no max duration.
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-stream-duration
for more information.
type: string
requestTimeout:
description: |-
RequestTimeout sets the client request timeout globally for Contour. Note that
Expand Down Expand Up @@ -4410,6 +4418,14 @@ spec:
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-connection-duration
for more information.
type: string
maxStreamDuration:
description: |-
MaxStreamDuration defines the maximum duration a HTTP stream is kept alive.
The stream will be reset if the time limit is reached. Omit or set to "infinity" for
no max duration.
See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-httpprotocoloptions-max-stream-duration
for more information.
type: string
requestTimeout:
description: |-
RequestTimeout sets the client request timeout globally for Contour. Note that
Expand Down Expand Up @@ -5285,6 +5301,12 @@ spec:
If not supplied, Envoy's default value of 1h applies.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
maxStreamDuration:
description: |-
Maximum allowed duration a streaming request can run for.
If not supplied, the global setting is used.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
response:
description: |-
Timeout for receiving a response from the server after processing a request from client.
Expand Down Expand Up @@ -7032,6 +7054,12 @@ spec:
If not supplied, Envoy's default value of 1h applies.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
maxStreamDuration:
description: |-
Maximum allowed duration a streaming request can run for.
If not supplied, the global setting is used.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+|infinity|infinite)$
type: string
response:
description: |-
Timeout for receiving a response from the server after processing a request from client.
Expand Down
Loading