Skip to content

Commit

Permalink
Getting the API into shape based on the reviews.
Browse files Browse the repository at this point in the history
Signed-off-by: Lior Okman <[email protected]>
  • Loading branch information
liorokman committed Feb 7, 2024
1 parent 21a4036 commit e775ba9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 236 deletions.
18 changes: 3 additions & 15 deletions api/v1alpha1/clienttrafficpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,10 @@ const (

// HeaderSettings providess configuration options for headers on the listener.
type HeaderSettings struct {
// SuppressEnvoyHeaders configures the Envoy Router filter to suppress the "x-envoy-'
// headers from both requests and responses.
// By default these headers are added to both requests and responses.
//
// +optional
SuppressEnvoyHeaders *bool `json:"suppressEnvoyHeaders,omitempty"`
// ServerName is the value to be used if the server header transformation
// requested is Overwrite or AppendIfAbsent. Defaults to "envoy" if not specified.
//
// +optional
ServerName *string `json:"serverName,omitempty"`
// ServerHeaderTransformation defines how the Server header should be handled for
// proxied traffic. Defaults to "Overwrite".
//
// EnableEnvoyHeaders configures Envoy Proxy to add the "X-Envoy-" headers to requests
// and responses.
// +optional
ServerHeaderTransformation *ServerHeaderTransformation `json:"serverHeaderTransformation,omitempty"`
EnableEnvoyHeaders *bool `json:"enableEnvoyHeaders,omitempty"`
}

// ClientIPDetectionSettings provides configuration for determining the original client IP address for requests.
Expand Down
14 changes: 2 additions & 12 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 @@ -72,24 +72,9 @@ spec:
headers:
description: HeaderSettings provides configuration for header management.
properties:
serverHeaderTransformation:
description: ServerHeaderTransformation defines how the Server
header should be handled for proxied traffic. Defaults to "Overwrite".
enum:
- Overwrite
- AppendIfAbsent
- PassThrough
type: string
serverName:
description: ServerName is the value to be used if the server
header transformation requested is Overwrite or AppendIfAbsent.
Defaults to "envoy" if not specified.
type: string
suppressEnvoyHeaders:
description: SuppressEnvoyHeaders configures the Envoy Router
filter to suppress the "x-envoy-' headers from both requests
and responses. By default these headers are added to both requests
and responses.
enableEnvoyHeaders:
description: EnableEnvoyHeaders configures Envoy Proxy to add
the "X-Envoy-" headers to requests and responses.
type: boolean
type: object
http1:
Expand Down
2 changes: 1 addition & 1 deletion internal/gatewayapi/clienttrafficpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ func translateListenerHeaderSettings(headerSettings *egv1a1.HeaderSettings, http
if headerSettings == nil {
return
}
httpIR.SuppressEnvoyHeaders = ptr.Deref(headerSettings.SuppressEnvoyHeaders, false)
httpIR.SuppressEnvoyHeaders = true

Check warning on line 394 in internal/gatewayapi/clienttrafficpolicy.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/clienttrafficpolicy.go#L394

Added line #L394 was not covered by tests
}

func translateHTTP1Settings(http1Settings *egv1a1.HTTP1Settings, httpIR *ir.HTTPListener) {
Expand Down

This file was deleted.

This file was deleted.

18 changes: 5 additions & 13 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# API Reference
+++
title = "API Reference"
+++


## Packages
- [gateway.envoyproxy.io/v1alpha1](#gatewayenvoyproxyiov1alpha1)
Expand Down Expand Up @@ -1185,9 +1188,7 @@ _Appears in:_

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `suppressEnvoyHeaders` | _boolean_ | false | SuppressEnvoyHeaders configures the Envoy Router filter to suppress the "x-envoy-' headers from both requests and responses. By default these headers are added to both requests and responses. |
| `serverName` | _string_ | false | ServerName is the value to be used if the server header transformation requested is Overwrite or AppendIfAbsent. Defaults to "envoy" if not specified. |
| `serverHeaderTransformation` | _[ServerHeaderTransformation](#serverheadertransformation)_ | false | ServerHeaderTransformation defines how the Server header should be handled for proxied traffic. Defaults to "Overwrite". |
| `enableEnvoyHeaders` | _boolean_ | false | EnableEnvoyHeaders configures Envoy Proxy to add the "X-Envoy-" headers to requests and responses. |


#### HealthCheck
Expand Down Expand Up @@ -2113,15 +2114,6 @@ _Appears in:_



#### ServerHeaderTransformation

_Underlying type:_ _string_

ServerHeaderTransformation specifies the transformation required for the Server header

_Appears in:_
- [HeaderSettings](#headersettings)



#### ServiceExternalTrafficPolicy
Expand Down

0 comments on commit e775ba9

Please sign in to comment.