diff --git a/api/v1alpha1/clienttrafficpolicy_types.go b/api/v1alpha1/clienttrafficpolicy_types.go index 594b17c0013..d1581188a09 100644 --- a/api/v1alpha1/clienttrafficpolicy_types.go +++ b/api/v1alpha1/clienttrafficpolicy_types.go @@ -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. diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index de67e46081d..b889410e3ab 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1743,21 +1743,11 @@ func (in *HeaderMatch) DeepCopy() *HeaderMatch { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HeaderSettings) DeepCopyInto(out *HeaderSettings) { *out = *in - if in.SuppressEnvoyHeaders != nil { - in, out := &in.SuppressEnvoyHeaders, &out.SuppressEnvoyHeaders + if in.EnableEnvoyHeaders != nil { + in, out := &in.EnableEnvoyHeaders, &out.EnableEnvoyHeaders *out = new(bool) **out = **in } - if in.ServerName != nil { - in, out := &in.ServerName, &out.ServerName - *out = new(string) - **out = **in - } - if in.ServerHeaderTransformation != nil { - in, out := &in.ServerHeaderTransformation, &out.ServerHeaderTransformation - *out = new(ServerHeaderTransformation) - **out = **in - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HeaderSettings. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml index c569fb61a71..258335fcca8 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml @@ -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: diff --git a/internal/gatewayapi/clienttrafficpolicy.go b/internal/gatewayapi/clienttrafficpolicy.go index 7b765e9cf28..9066e9876fb 100644 --- a/internal/gatewayapi/clienttrafficpolicy.go +++ b/internal/gatewayapi/clienttrafficpolicy.go @@ -391,7 +391,7 @@ func translateListenerHeaderSettings(headerSettings *egv1a1.HeaderSettings, http if headerSettings == nil { return } - httpIR.SuppressEnvoyHeaders = ptr.Deref(headerSettings.SuppressEnvoyHeaders, false) + httpIR.SuppressEnvoyHeaders = true } func translateHTTP1Settings(http1Settings *egv1a1.HTTP1Settings, httpIR *ir.HTTPListener) { diff --git a/internal/gatewayapi/testdata/clienttrafficpolicy-suppress-envoy-headers.in.yaml b/internal/gatewayapi/testdata/clienttrafficpolicy-suppress-envoy-headers.in.yaml deleted file mode 100644 index adf5d01f555..00000000000 --- a/internal/gatewayapi/testdata/clienttrafficpolicy-suppress-envoy-headers.in.yaml +++ /dev/null @@ -1,36 +0,0 @@ -clientTrafficPolicies: -- apiVersion: gateway.envoyproxy.io/v1alpha1 - kind: ClientTrafficPolicy - metadata: - namespace: envoy-gateway - name: target-gateway-1-section-http-1 - spec: - headers: - suppressEnvoyHeaders: true - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: gateway-1 - sectionName: http-1 - namespace: envoy-gateway -gateways: -- apiVersion: gateway.networking.k8s.io/v1 - kind: Gateway - metadata: - namespace: envoy-gateway - name: gateway-1 - spec: - gatewayClassName: envoy-gateway-class - listeners: - - name: http-1 - protocol: HTTP - port: 80 - allowedRoutes: - namespaces: - from: Same - - name: http-2 - protocol: HTTP - port: 8080 - allowedRoutes: - namespaces: - from: Same diff --git a/internal/gatewayapi/testdata/clienttrafficpolicy-suppress-envoy-headers.out.yaml b/internal/gatewayapi/testdata/clienttrafficpolicy-suppress-envoy-headers.out.yaml deleted file mode 100644 index d5d9cb7307e..00000000000 --- a/internal/gatewayapi/testdata/clienttrafficpolicy-suppress-envoy-headers.out.yaml +++ /dev/null @@ -1,141 +0,0 @@ -clientTrafficPolicies: -- apiVersion: gateway.envoyproxy.io/v1alpha1 - kind: ClientTrafficPolicy - metadata: - creationTimestamp: null - name: target-gateway-1-section-http-1 - namespace: envoy-gateway - spec: - headers: - suppressEnvoyHeaders: true - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: gateway-1 - namespace: envoy-gateway - sectionName: http-1 - status: - conditions: - - lastTransitionTime: null - message: ClientTrafficPolicy has been accepted. - reason: Accepted - status: "True" - type: Accepted -gateways: -- apiVersion: gateway.networking.k8s.io/v1 - kind: Gateway - metadata: - creationTimestamp: null - name: gateway-1 - namespace: envoy-gateway - spec: - gatewayClassName: envoy-gateway-class - listeners: - - allowedRoutes: - namespaces: - from: Same - name: http-1 - port: 80 - protocol: HTTP - - allowedRoutes: - namespaces: - from: Same - name: http-2 - port: 8080 - protocol: HTTP - status: - listeners: - - attachedRoutes: 0 - conditions: - - lastTransitionTime: null - message: Sending translated listener configuration to the data plane - reason: Programmed - status: "True" - type: Programmed - - lastTransitionTime: null - message: Listener has been successfully translated - reason: Accepted - status: "True" - type: Accepted - - lastTransitionTime: null - message: Listener references have been resolved - reason: ResolvedRefs - status: "True" - type: ResolvedRefs - name: http-1 - supportedKinds: - - group: gateway.networking.k8s.io - kind: HTTPRoute - - group: gateway.networking.k8s.io - kind: GRPCRoute - - attachedRoutes: 0 - conditions: - - lastTransitionTime: null - message: Sending translated listener configuration to the data plane - reason: Programmed - status: "True" - type: Programmed - - lastTransitionTime: null - message: Listener has been successfully translated - reason: Accepted - status: "True" - type: Accepted - - lastTransitionTime: null - message: Listener references have been resolved - reason: ResolvedRefs - status: "True" - type: ResolvedRefs - name: http-2 - supportedKinds: - - group: gateway.networking.k8s.io - kind: HTTPRoute - - group: gateway.networking.k8s.io - kind: GRPCRoute -infraIR: - envoy-gateway/gateway-1: - proxy: - listeners: - - address: null - name: envoy-gateway/gateway-1/http-1 - ports: - - containerPort: 10080 - name: http-1 - protocol: HTTP - servicePort: 80 - - address: null - name: envoy-gateway/gateway-1/http-2 - ports: - - containerPort: 8080 - name: http-2 - protocol: HTTP - servicePort: 8080 - metadata: - labels: - gateway.envoyproxy.io/owning-gateway-name: gateway-1 - gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway - name: envoy-gateway/gateway-1 -xdsIR: - envoy-gateway/gateway-1: - accessLog: - text: - - path: /dev/stdout - http: - - address: 0.0.0.0 - hostnames: - - '*' - isHTTP2: false - name: envoy-gateway/gateway-1/http-1 - path: - escapedSlashesAction: UnescapeAndRedirect - mergeSlashes: true - port: 10080 - suppressEnvoyHeaders: true - - address: 0.0.0.0 - hostnames: - - '*' - isHTTP2: false - name: envoy-gateway/gateway-1/http-2 - path: - escapedSlashesAction: UnescapeAndRedirect - mergeSlashes: true - port: 8080 diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index 8c872aa2cc9..bd54181befd 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -1,4 +1,7 @@ -# API Reference ++++ +title = "API Reference" ++++ + ## Packages - [gateway.envoyproxy.io/v1alpha1](#gatewayenvoyproxyiov1alpha1) @@ -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 @@ -2113,15 +2114,6 @@ _Appears in:_ -#### ServerHeaderTransformation - -_Underlying type:_ _string_ - -ServerHeaderTransformation specifies the transformation required for the Server header - -_Appears in:_ -- [HeaderSettings](#headersettings) - #### ServiceExternalTrafficPolicy