Skip to content

Commit

Permalink
Modified the proposed API as per the discussions in Slack and the
Browse files Browse the repository at this point in the history
community meetings.

Signed-off-by: Lior Okman <[email protected]>
  • Loading branch information
liorokman committed Apr 10, 2024
1 parent 0b77567 commit 6804cf9
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 43 deletions.
29 changes: 10 additions & 19 deletions api/v1alpha1/backendtrafficpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,10 @@ type BackendTrafficPolicySpec struct {
// +optional
Retry *Retry `json:"retry,omitempty"`

// UpstreamHTTPVersion defines which HTTP version to use for connecting to the attached backend.
// This option can only be specified on policies attached to HTTPRoute targetRefs.
// If not specified, the default is "SameAsDownstream".
// HTTP contains configuration options that are only relevant for backends that use the HTTP protocol
//
// +optional
UpstreamHTTPVersion *HTTPVersion `json:"upstreamHTTPVersion,omitempty"`
HTTP *HTTPOptions `json:"http,omitempty"`

// Timeout settings for the backend connections.
//
Expand All @@ -106,21 +104,14 @@ type BackendTrafficPolicySpec struct {
Compression []*Compression `json:"compression,omitempty"`
}

// HTTPVersion defines HTTP version selection options
// +kubebuilder:validation:Enum="SameAsDownstream;HTTP1;HTTP2;HTTP3"
type HTTPVersion string

const (
// DownstreamHTTPVersion forces Envoy to use the same protocol version as the one used by
// the downstream client
DownstreamHTTPVersion HTTPVersion = "SameAsDownstream"
// HTTP1Version forces Envoy to use HTTP/1.1 for connecting to the backend
HTTP1Version HTTPVersion = "HTTP1"
// HTTP2Version forces Envoy to use HTTP/2 for connecting to the backend
HTTP2Version HTTPVersion = "HTTP2"
// HTTP3Version forces Envoy to use HTTP/3 for connecting to the backend
HTTP3Version HTTPVersion = "HTTP3"
)
type HTTPOptions struct {
// UseClientProtocol configures Envoy to prefer sending requests to TLS enabled backends using
// the same HTTP protocol that the incoming request used. Defaults to false, which means
// that Envoy will use the protocol indicated by the attached BackendRef.
//
// +optional
UseClientProtocol *bool `json:"useClientProtocol,omitempty"`
}

// +kubebuilder:object:root=true
// BackendTrafficPolicyList contains a list of BackendTrafficPolicy resources.
Expand Down
28 changes: 24 additions & 4 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,17 @@ spec:
type: boolean
type: object
type: object
http:
description: HTTP contains configuration options that are only relevant
for backends that use the HTTP protocol
properties:
useClientProtocol:
description: |-
UseClientProtocol configures Envoy to prefer sending requests to TLS enabled backends using
the same HTTP protocol that the incoming request used. Defaults to false, which means
that Envoy will use the protocol indicated by the attached BackendRef.
type: boolean
type: object
loadBalancer:
description: |-
LoadBalancer policy to apply when routing traffic from the gateway to
Expand Down Expand Up @@ -961,14 +972,6 @@ spec:
type: string
type: object
type: object
upstreamHTTPVersion:
description: |-
UpstreamHTTPVersion defines which HTTP version to use for connecting to the attached backend.
This option can only be specified on policies attached to HTTPRoute targetRefs.
If not specified, the default is "SameAsDownstream".
enum:
- SameAsDownstream;HTTP1;HTTP2;HTTP3
type: string
required:
- targetRef
type: object
Expand Down
27 changes: 15 additions & 12 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ _Appears in:_
| `faultInjection` | _[FaultInjection](#faultinjection)_ | false | FaultInjection defines the fault injection policy to be applied. This configuration can be used to<br />inject delays and abort requests to mimic failure scenarios such as service failures and overloads |
| `circuitBreaker` | _[CircuitBreaker](#circuitbreaker)_ | false | Circuit Breaker settings for the upstream connections and requests.<br />If not set, circuit breakers will be enabled with the default thresholds |
| `retry` | _[Retry](#retry)_ | false | Retry provides more advanced usage, allowing users to customize the number of retries, retry fallback strategy, and retry triggering conditions.<br />If not set, retry will be disabled. |
| `upstreamHTTPVersion` | _[HTTPVersion](#httpversion)_ | false | UpstreamHTTPVersion defines which HTTP version to use for connecting to the attached backend.<br />This option can only be specified on policies attached to HTTPRoute targetRefs.<br />If not specified, the default is "SameAsDownstream". |
| `http` | _[HTTPOptions](#httpoptions)_ | false | HTTP contains configuration options that are only relevant for backends that use the HTTP protocol |
| `timeout` | _[Timeout](#timeout)_ | false | Timeout settings for the backend connections. |
| `compression` | _[Compression](#compression) array_ | false | The compression config for the http streams. |

Expand Down Expand Up @@ -1344,6 +1344,20 @@ _Appears in:_
| `headersToBackend` | _string array_ | false | HeadersToBackend are the authorization response headers that will be added<br />to the original client request before sending it to the backend server.<br />Note that coexisting headers will be overridden.<br />If not specified, no authorization response headers will be added to the<br />original client request. |


#### HTTPOptions





_Appears in:_
- [BackendTrafficPolicySpec](#backendtrafficpolicyspec)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `useClientProtocol` | _boolean_ | false | UseClientProtocol configures Envoy to prefer sending requests to TLS enabled backends using<br />the same HTTP protocol that the incoming request used. Defaults to false, which means<br />that Envoy will use the protocol indicated by the attached BackendRef. |


#### HTTPStatus

_Underlying type:_ _integer_
Expand Down Expand Up @@ -1371,17 +1385,6 @@ _Appears in:_
| `maxConnectionDuration` | _[Duration](#duration)_ | false | The maximum duration of an HTTP connection.<br />Default: unlimited. |


#### HTTPVersion

_Underlying type:_ _string_

HTTPVersion defines HTTP version selection options

_Appears in:_
- [BackendTrafficPolicySpec](#backendtrafficpolicyspec)



#### HTTPWasmCodeSource


Expand Down

0 comments on commit 6804cf9

Please sign in to comment.