diff --git a/helm/core/README.md b/helm/core/README.md index 0ccad6dfb..0927af06e 100644 --- a/helm/core/README.md +++ b/helm/core/README.md @@ -1,5 +1,5 @@ -# Higress Core Helm Chart - -Installs the core components of cloud-native gateway [Higress](http://higress.io/) - -**Note:** It is highly recommended to install the whole package of Higress. Please visit https://higress.io/docs/user/quickstart/ for details. +# Higress Core Helm Chart + +Installs the core components of cloud-native gateway [Higress](http://higress.io/) + +**Note:** It is highly recommended to install the whole package of Higress. Please visit https://higress.io/docs/user/quickstart/ for details. diff --git a/helm/core/templates/configmap.yaml b/helm/core/templates/configmap.yaml index abb3b34ed..b8aaf3b5b 100644 --- a/helm/core/templates/configmap.yaml +++ b/helm/core/templates/configmap.yaml @@ -112,6 +112,9 @@ data: {{- if hasKey .Values "downstream" }} {{- $_ := set $newData "downstream" .Values.downstream }} {{- end }} + {{- if hasKey .Values "gzip" }} + {{- $_ := set $newData "gzip" .Values.gzip }} + {{- end }} {{- if and (hasKey .Values "tracing") .Values.tracing.enable }} {{- $_ := set $newData "tracing" .Values.tracing }} {{- end }} diff --git a/helm/core/values.yaml b/helm/core/values.yaml index 07a2d283a..7e37d7246 100644 --- a/helm/core/values.yaml +++ b/helm/core/values.yaml @@ -732,6 +732,26 @@ upstream: idleTimeout: 10 connectionBufferLimits: 10485760 +# -- Gzip compression settings +gzip: + enable: true + minContentLength: 1024 + contentType: + - "text/html" + - "text/css" + - "text/plain" + - "text/xml" + - "application/json" + - "application/javascript" + - "application/xhtml+xml" + - "image/svg+xml" + disableOnEtagHeader: true + memoryLevel: 5 + windowBits: 12 + chunkSize: 4096 + compressionLevel: "BEST_COMPRESSION" + compressionStrategy: "DEFAULT_STRATEGY" + redis: redis: name: redis-stack-server diff --git a/helm/higress/README.md b/helm/higress/README.md index 9418e2d24..b383efce5 100644 --- a/helm/higress/README.md +++ b/helm/higress/README.md @@ -242,6 +242,7 @@ The command removes all the Kubernetes components associated with the chart and | global.useMCP | bool | `false` | Use the Mesh Control Protocol (MCP) for configuring Istiod. Requires an MCP source. | | global.watchNamespace | string | `""` | If not empty, Higress Controller will only watch resources in the specified namespace. When isolating different business systems using K8s namespace, if each namespace requires a standalone gateway instance, this parameter can be used to confine the Ingress watching of Higress within the given namespace. | | global.xdsMaxRecvMsgSize | string | `"104857600"` | | +| gzip | object | `{"chunkSize":4096,"compressionLevel":"BEST_COMPRESSION","compressionStrategy":"DEFAULT_STRATEGY","contentType":["text/html","text/css","text/plain","text/xml","application/json","application/javascript","application/xhtml+xml","image/svg+xml"],"disableOnEtagHeader":true,"enable":true,"memoryLevel":5,"minContentLength":1024,"windowBits":12}` | Gzip compression settings | | hub | string | `"higress-registry.cn-hangzhou.cr.aliyuncs.com/higress"` | | | meshConfig | object | `{"enablePrometheusMerge":true,"rootNamespace":null,"trustDomain":"cluster.local"}` | meshConfig defines runtime configuration of components, including Istiod and istio-agent behavior See https://istio.io/docs/reference/config/istio.mesh.v1alpha1/ for all available options | | meshConfig.rootNamespace | string | `nil` | The namespace to treat as the administrative root namespace for Istio configuration. When processing a leaf namespace Istio will search for declarations in that namespace first and if none are found it will search in the root namespace. Any matching declaration found in the root namespace is processed as if it were declared in the leaf namespace. | diff --git a/pkg/ingress/kube/configmap/gzip.go b/pkg/ingress/kube/configmap/gzip.go index 248c7e43b..f35fcf5dc 100644 --- a/pkg/ingress/kube/configmap/gzip.go +++ b/pkg/ingress/kube/configmap/gzip.go @@ -144,7 +144,7 @@ func deepCopyGzip(gzip *Gzip) (*Gzip, error) { func NewDefaultGzip() *Gzip { gzip := &Gzip{ - Enable: false, + Enable: true, MinContentLength: 1024, ContentType: []string{"text/html", "text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"}, DisableOnEtagHeader: true, diff --git a/pkg/ingress/kube/configmap/gzip_test.go b/pkg/ingress/kube/configmap/gzip_test.go index 12632b1f3..29b393127 100644 --- a/pkg/ingress/kube/configmap/gzip_test.go +++ b/pkg/ingress/kube/configmap/gzip_test.go @@ -374,7 +374,7 @@ func TestGzipController_AddOrUpdateHigressConfig(t *testing.T) { new: &HigressConfig{ Gzip: &Gzip{ Enable: true, - MinContentLength: 1024, + MinContentLength: 2048, // Changed from 1024 to make it different from default ContentType: []string{"text/html", "text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"}, DisableOnEtagHeader: true, MemoryLevel: 5, @@ -388,7 +388,7 @@ func TestGzipController_AddOrUpdateHigressConfig(t *testing.T) { wantEventPush: "push", wantGzip: &Gzip{ Enable: true, - MinContentLength: 1024, + MinContentLength: 2048, // Changed from 1024 to make it different from default ContentType: []string{"text/html", "text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"}, DisableOnEtagHeader: true, MemoryLevel: 5, diff --git a/test/e2e/conformance/tests/configmap-global.go b/test/e2e/conformance/tests/configmap-global.go index ff099f381..dd77cea94 100644 --- a/test/e2e/conformance/tests/configmap-global.go +++ b/test/e2e/conformance/tests/configmap-global.go @@ -1077,4 +1077,4 @@ var ConfigMapGlobalEnvoy = suite.ConformanceTest{ } }) }, -} +} \ No newline at end of file diff --git a/test/e2e/conformance/tests/configmap-gzip.go b/test/e2e/conformance/tests/configmap-gzip.go index 133997013..301a300b8 100644 --- a/test/e2e/conformance/tests/configmap-gzip.go +++ b/test/e2e/conformance/tests/configmap-gzip.go @@ -73,25 +73,12 @@ var testCases = []struct { }, }, envoyAssertion: envoy.Assertion{ - Path: "configs.#.dynamic_listeners.#.active_state.listener.filter_chains", + Path: "configs.#.dynamic_listeners.#.active_state.listener.filter_chains.#.filters.#.typed_config.http_filters", TargetNamespace: "higress-system", CheckType: envoy.CheckTypeNotExist, ExpectEnvoyConfig: map[string]interface{}{ - "memory_level": 5, - "compression_level": "COMPRESSION_LEVEL_9", - "window_bits": 12, - "min_content_length": 1024, - "disable_on_etag_header": true, - "content_type": []interface{}{ - "text/html", - "text/css", - "text/plain", - "text/xml", - "application/json", - "application/javascript", - "application/xhtml+xml", - "image/svg+xml", - }, + "name": "envoy.filters.http.gzip", + "@type": "type.googleapis.com/envoy.extensions.filters.http.gzip.v3.Gzip", }, }, }, @@ -323,4 +310,4 @@ var ConfigMapGzipEnvoy = suite.ConformanceTest{ } }) }, -} +} \ No newline at end of file