Skip to content

Commit

Permalink
api: add compressor/decompressor support (#2474)
Browse files Browse the repository at this point in the history
* Add API for compressor

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* update

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* update

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* update

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* update doc

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* generate manifests

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* generate

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* address comments

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* generate manifests

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* address comments

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* generate

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* update

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* generate

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* update comments

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* generate

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* address comments

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* generate

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* address comments

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* generate

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

* generate again

Signed-off-by: He Jie Xu <hejie.xu@intel.com>

---------

Signed-off-by: He Jie Xu <hejie.xu@intel.com>
  • Loading branch information
soulxu authored Jan 26, 2024
1 parent 8aa432c commit 0bd88fe
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/v1alpha1/backendtrafficpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ type BackendTrafficPolicySpec struct {
//
// +optional
Timeout *Timeout `json:"timeout,omitempty"`

// The compression config for the http streams.
//
// +optional
Compression []*Compression `json:"compression,omitempty"`
}

// BackendTrafficPolicyStatus defines the state of BackendTrafficPolicy
Expand Down
31 changes: 31 additions & 0 deletions api/v1alpha1/compression_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright Envoy Gateway Authors
// SPDX-License-Identifier: Apache-2.0
// The full text of the Apache license is available in the LICENSE file at
// the root of the repo.

package v1alpha1

// CompressorType defines the types of compressor library supported by Envoy Gateway.
//
// +kubebuilder:validation:Enum=Gzip
type CompressorType string

// GzipCompressor defines the config for the Gzip compressor.
// The default values can be found here:
// https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/compression/gzip/compressor/v3/gzip.proto#extension-envoy-compression-gzip-compressor
type GzipCompressor struct {
}

// Compression defines the config of enabling compression.
// This can help reduce the bandwidth at the expense of higher CPU.
type Compression struct {
// CompressorType defines the compressor type to use for compression.
//
// +required
Type CompressorType `json:"type"`

// The configuration for GZIP compressor.
//
// +optional
Gzip *GzipCompressor `json:"gzip,omitempty"`
}
46 changes: 46 additions & 0 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 @@ -77,6 +77,25 @@ spec:
minimum: 0
type: integer
type: object
compression:
description: The compression config for the http streams.
items:
description: Compression defines the config of enabling compression.
This can help reduce the bandwidth at the expense of higher CPU.
properties:
gzip:
description: The configuration for GZIP compressor.
type: object
type:
description: CompressorType defines the compressor type to use
for compression.
enum:
- Gzip
type: string
required:
- type
type: object
type: array
faultInjection:
description: FaultInjection defines the fault injection policy to
be applied. This configuration can be used to inject delays and
Expand Down
38 changes: 38 additions & 0 deletions site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ _Appears in:_
| `faultInjection` _[FaultInjection](#faultinjection)_ | FaultInjection defines the fault injection policy to be applied. This configuration can be used to inject delays and abort requests to mimic failure scenarios such as service failures and overloads |
| `circuitBreaker` _[CircuitBreaker](#circuitbreaker)_ | Circuit Breaker settings for the upstream connections and requests. If not set, circuit breakers will be enabled with the default thresholds |
| `timeout` _[Timeout](#timeout)_ | Timeout settings for the backend connections. |
| `compression` _[Compression](#compression) array_ | The compression config for the http streams. |



Expand Down Expand Up @@ -244,6 +245,32 @@ _Appears in:_
References to a resource in different namespace are invalid UNLESS there is a ReferenceGrant in the target namespace that allows the certificate to be attached. |


#### Compression



Compression defines the config of enabling compression. This can help reduce the bandwidth at the expense of higher CPU.

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

| Field | Description |
| --- | --- |
| `type` _[CompressorType](#compressortype)_ | CompressorType defines the compressor type to use for compression. |
| `gzip` _[GzipCompressor](#gzipcompressor)_ | The configuration for GZIP compressor. |


#### CompressorType

_Underlying type:_ `string`

CompressorType defines the types of compressor library supported by Envoy Gateway.

_Appears in:_
- [Compression](#compression)



#### ConsistentHash


Expand Down Expand Up @@ -933,6 +960,17 @@ _Appears in:_
| `kind` _string_ | |


#### GzipCompressor



GzipCompressor defines the config for the Gzip compressor. The default values can be found here: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/compression/gzip/compressor/v3/gzip.proto#extension-envoy-compression-gzip-compressor

_Appears in:_
- [Compression](#compression)



#### HTTP1Settings


Expand Down

0 comments on commit 0bd88fe

Please sign in to comment.