Skip to content

Commit 3f2204f

Browse files
authored
Merge pull request #39982 from skrthomas/OSDOCS-3009
OSDOCS-3009:Adding route compression to Ingress
2 parents 0f5f5bb + 9569778 commit 3f2204f

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * networking/ingress_operator.adoc
4+
5+
[id="nw-configuring-router-compression_{context}"]
6+
= Using router compression
7+
8+
You configure the HAProxy Ingress Controller to specify router compression globally for specific MIME types. You can use the `mimeTypes` variable to define the formats of MIME types to which compression is applied. The types are: application, image, message, multipart, text, video, or a custom type prefaced by "X-". To see the full notation for MIME types and subtypes, see link:https://datatracker.ietf.org/doc/html/rfc1341#page-7[RFC1341].
9+
10+
[NOTE]
11+
====
12+
Memory allocated for compression can affect the max connections. Additionally, compression of large buffers can cause latency, like heavy regex or long lists of regex.
13+
14+
Not all MIME types benefit from compression, but HAProxy still uses resources to try to compress if instructed to. Generally, text formats, such as html, css, and js, formats benefit from compression, but formats that are already compressed, such as image, audio, and video, benefit little in exchange for the time and resources spent on compression.
15+
====
16+
17+
.Procedure
18+
19+
. Configure the `httpCompression` field for the Ingress Controller.
20+
.. Use the following command to edit the `IngressController` resource:
21+
+
22+
[source,terminal]
23+
----
24+
$ oc edit -n openshift-ingress-operator ingresscontrollers/default
25+
----
26+
+
27+
.. Under `spec`, set the `httpCompression` policy field to `mimeTypes` and specify a list of MIME types that should have compression applied:
28+
+
29+
[source,yaml]
30+
----
31+
apiVersion: operator.openshift.io/v1
32+
kind: IngressController
33+
metadata:
34+
name: default
35+
namespace: openshift-ingress-operator
36+
spec:
37+
httpCompression:
38+
mimeTypes:
39+
- "text/html"
40+
- "text/css; charset=utf-8"
41+
- "application/json"
42+
...
43+
----

modules/nw-ingress-controller-configuration-parameters.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ The Ingress Operator converts the TLS `1.0` of an `Old` or `Custom` profile to `
110110
`clientTLS` has the required subfields, `spec.clientTLS.clientCertificatePolicy` and `spec.clientTLS.ClientCA`.
111111

112112
The `ClientCertificatePolicy` subfield accepts one of the two values: `Required` or `Optional`. The `ClientCA` subfield specifies a config map that is in the openshift-config namespace. The config map should contain a CA certificate bundle.
113-
The `AllowedSubjectPatterns` is an optional value that specifies a list of regular expressions, which are matched against the distinguished name on a valid client certificate to filter requests. The regular expressions must use PCRE syntax. At least one pattern must match a client certificate's distinguished name; otherwise, the ingress controller rejects the certificate and denies the connection. If not specified, the ingress controller does not reject certificates based on the distinguished name.
113+
The `AllowedSubjectPatterns` is an optional value that specifies a list of regular expressions, which are matched against the distinguished name on a valid client certificate to filter requests. The regular expressions must use PCRE syntax. At least one pattern must match a client certificate's distinguished name; otherwise, the ingress controller rejects the certificate and denies the connection. If not specified, the ingress controller does not reject certificates based on the distinguished name.
114114

115115
|`routeAdmission`
116116
|`routeAdmission` defines a policy for handling new route claims, such as allowing or denying claims across namespaces.
@@ -159,6 +159,11 @@ These adjustments are only applied to cleartext, edge-terminated, and re-encrypt
159159

160160
For request headers, these adjustments are applied only for routes that have the `haproxy.router.openshift.io/h1-adjust-case=true` annotation. For response headers, these adjustments are applied to all HTTP responses. If this field is empty, no request headers are adjusted.
161161

162+
|`httpCompression`
163+
|`httpCompression` defines the policy for HTTP traffic compression.
164+
165+
* `mimeTypes` defines a list of MIME types to which compression should be applied. For example, `text/css; charset=utf-8`, `text/html`, `text/*`, `image/svg+xml`, `application/octet-stream`, `X-custom/customsub`, using the format pattern, `type/subtype; [;attribute=value]`. The `types` are: application, image, message, multipart, text, video, or a custom type prefaced by `X-`; e.g. To see the full notation for MIME types and subtypes, see link:https://datatracker.ietf.org/doc/html/rfc1341#page-7[RFC1341]
166+
162167
|`httpErrorCodePages`
163168
|`httpErrorCodePages` specifies custom HTTP error code response pages. By default, an IngressController uses error pages built into the IngressController image.
164169

networking/ingress-operator.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ include::modules/nw-ingress-configuring-application-domain.adoc[leveloffset=+2]
7272

7373
include::modules/nw-ingress-converting-http-header-case.adoc[leveloffset=+2]
7474

75+
include::modules/nw-configuring-router-compression.adoc[leveloffset=+2]
76+
7577
include::modules/nw-customize-ingress-error-pages.adoc[leveloffset=+2]
7678
//include::modules/nw-ingress-select-route.adoc[leveloffset=+2]
7779

0 commit comments

Comments
 (0)