-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compressor: expose generic compressor filter to users #10553
Changes from 9 commits
47139ba
4bc9660
b7cfac0
fd7fab2
7bfd623
153f97e
09f10a9
d9b33cc
90d02d5
05a8541
c3c26b6
ece1755
3323683
b7e1d28
85676a2
681d7c4
79051a7
9bcc469
21fb4eb
2f48548
63085ac
edbe6b5
da5a305
76c2b1f
bc086c0
3f89444
801bdcf
8e12669
79ac3b9
2bdbee3
d72e015
85ae344
d833c1a
388d8bc
6ea514a
d43fb14
1498c20
4d09cd2
eabd93d
c69e0bb
63a6e46
cf473a7
02024a3
590167c
680ae29
dd93ad6
e6f9c79
9aaf9ff
d9ee8e0
503c81a
b3a49d2
6ede080
c5149d2
9b59cac
a271f28
bc77b25
4a9bff7
5f683bd
786ab77
6a9b477
4b4cfda
00fc997
8c37ff1
152a6b7
6b23035
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# DO NOT EDIT. This file is generated by tools/proto_sync.py. | ||
|
||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
||
licenses(["notice"]) # Apache 2 | ||
|
||
api_proto_package( | ||
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
syntax = "proto3"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does this relate to https://github.com/envoyproxy/envoy/blob/master/api/envoy/config/filter/http/gzip/v2/gzip.proto? Which one should service operators configure and when? Is the former deprecated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly, the former is deprecated. We need to make that clear as @htuch points out, have text in deprecated.rst, and also make sure the deprecated feature warning/stat is incremented so that operators know thy need to upgrade. |
||
|
||
package envoy.config.filter.http.compressor.gzip.v2; | ||
|
||
import "google/protobuf/wrappers.proto"; | ||
|
||
import "udpa/annotations/migrate.proto"; | ||
import "udpa/annotations/status.proto"; | ||
import "validate/validate.proto"; | ||
|
||
option java_package = "io.envoyproxy.envoy.config.filter.http.compressor.gzip.v2"; | ||
option java_outer_classname = "GzipProto"; | ||
option java_multiple_files = true; | ||
option (udpa.annotations.file_migrate).move_to_package = | ||
"envoy.extensions.filters.http.compressor.gzip.v3"; | ||
option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
|
||
// [#protodoc-title: Gzip] | ||
// [#extension: envoy.filters.http.compressor.gzip] | ||
|
||
// [#next-free-field: 10] | ||
message Gzip { | ||
enum CompressionStrategy { | ||
// The DEFAULT value translates directly to zlib's Z_DEFAULT_STRATEGY. It doesn't | ||
// equate to any other strategy. | ||
DEFAULT = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you comment on what the DEFAULTs are here and below? These should be fixed in the API. |
||
|
||
FILTERED = 1; | ||
|
||
HUFFMAN = 2; | ||
|
||
RLE = 3; | ||
} | ||
|
||
message CompressionLevel { | ||
enum Enum { | ||
DEFAULT = 0; | ||
BEST = 1; | ||
SPEED = 2; | ||
} | ||
} | ||
htuch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Value from 1 to 9 that controls the amount of internal memory used by zlib. Higher values | ||
// use more memory, but are faster and produce better compression results. The default value is 5. | ||
google.protobuf.UInt32Value memory_level = 1 [(validate.rules).uint32 = {lte: 9 gte: 1}]; | ||
|
||
// A value used for selecting the zlib compression level. This setting will affect speed and | ||
// amount of compression applied to the content. "BEST" provides higher compression at the cost of | ||
// higher latency, "SPEED" provides lower compression with minimum impact on response time. | ||
// "DEFAULT" provides an optimal result between speed and compression. This field will be set to | ||
// "DEFAULT" if not specified. | ||
CompressionLevel.Enum compression_level = 3 [(validate.rules).enum = {defined_only: true}]; | ||
|
||
// A value used for selecting the zlib compression strategy which is directly related to the | ||
// characteristics of the content. Most of the time "DEFAULT" will be the best choice, though | ||
// there are situations which changing this parameter might produce better results. For example, | ||
// run-length encoding (RLE) is typically used when the content is known for having sequences | ||
// which same data occurs many consecutive times. For more information about each strategy, please | ||
// refer to zlib manual. | ||
CompressionStrategy compression_strategy = 4 [(validate.rules).enum = {defined_only: true}]; | ||
|
||
// Value from 9 to 15 that represents the base two logarithmic of the compressor's window size. | ||
// Larger window results in better compression at the expense of memory usage. The default is 12 | ||
// which will produce a 4096 bytes window. For more details about this parameter, please refer to | ||
// zlib manual > deflateInit2. | ||
google.protobuf.UInt32Value window_bits = 9 [(validate.rules).uint32 = {lte: 15 gte: 9}]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,10 +4,12 @@ package envoy.config.filter.http.compressor.v2; | |
|
||
import "envoy/api/v2/core/base.proto"; | ||
|
||
import "google/protobuf/any.proto"; | ||
import "google/protobuf/wrappers.proto"; | ||
|
||
import "udpa/annotations/migrate.proto"; | ||
import "udpa/annotations/status.proto"; | ||
import "validate/validate.proto"; | ||
|
||
option java_package = "io.envoyproxy.envoy.config.filter.http.compressor.v2"; | ||
option java_outer_classname = "CompressorProto"; | ||
|
@@ -17,8 +19,10 @@ option (udpa.annotations.file_migrate).move_to_package = | |
option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
|
||
// [#protodoc-title: Compressor] | ||
// Compressor :ref:`configuration overview <config_http_filters_compressor>`. | ||
// [#extension: envoy.filters.http.compressor] | ||
|
||
// [#next-free-field: 6] | ||
// [#next-free-field: 7] | ||
message Compressor { | ||
// Minimum response length, in bytes, which will trigger compression. The default value is 30. | ||
google.protobuf.UInt32Value content_length = 1; | ||
|
@@ -45,4 +49,21 @@ message Compressor { | |
// Runtime flag that controls whether the filter is enabled or not. If set to false, the | ||
// filter will operate as a pass-through filter. If not specified, defaults to enabled. | ||
api.v2.core.RuntimeFeatureFlag runtime_enabled = 5; | ||
|
||
// A compressor library to use for compression. Currently only | ||
// :ref:`envoy.filters.http.compressor.gzip<envoy_api_msg_config.filter.http.compressor.gzip.v2.Gzip>` | ||
// is included in Envoy. | ||
// | ||
// This field is ignored when used in the context of the deprecated "envoy.filters.http.gzip" | ||
// filter. | ||
CompressorLibrary compressor_library = 6; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure it makes sense to have a default here. Can we require this and then make the gzip config explicit for clarity? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, this field is required now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make it required via annotation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm... This message is used also in the deprecated
|
||
} | ||
|
||
message CompressorLibrary { | ||
// The name of the compressor library to instantiate for the filter. | ||
string name = 1 [(validate.rules).string = {min_bytes: 1}]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove this for new extensions as the extension will be looked up via the typed_config. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeap, removed. |
||
|
||
// Compressor library specific configuration. See the supported libraries for further | ||
// documentation. | ||
google.protobuf.Any typed_config = 2; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# DO NOT EDIT. This file is generated by tools/proto_sync.py. | ||
|
||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
||
licenses(["notice"]) # Apache 2 | ||
|
||
api_proto_package( | ||
deps = [ | ||
"//envoy/config/filter/http/compressor/gzip/v2:pkg", | ||
"@com_github_cncf_udpa//udpa/annotations:pkg", | ||
], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
syntax = "proto3"; | ||
|
||
package envoy.extensions.filters.http.compressor.gzip.v3; | ||
|
||
import "google/protobuf/wrappers.proto"; | ||
|
||
import "udpa/annotations/status.proto"; | ||
import "udpa/annotations/versioning.proto"; | ||
import "validate/validate.proto"; | ||
|
||
option java_package = "io.envoyproxy.envoy.extensions.filters.http.compressor.gzip.v3"; | ||
option java_outer_classname = "GzipProto"; | ||
option java_multiple_files = true; | ||
option (udpa.annotations.file_status).package_version_status = NEXT_MAJOR_VERSION_CANDIDATE; | ||
|
||
// [#protodoc-title: Gzip] | ||
// [#extension: envoy.filters.http.compressor.gzip] | ||
|
||
// [#next-free-field: 10] | ||
message Gzip { | ||
option (udpa.annotations.versioning).previous_message_type = | ||
"envoy.config.filter.http.compressor.gzip.v2.Gzip"; | ||
|
||
enum CompressionStrategy { | ||
// The DEFAULT value translates directly to zlib's Z_DEFAULT_STRATEGY. It doesn't | ||
// equate to any other strategy. | ||
DEFAULT = 0; | ||
|
||
FILTERED = 1; | ||
|
||
HUFFMAN = 2; | ||
|
||
RLE = 3; | ||
} | ||
|
||
message CompressionLevel { | ||
option (udpa.annotations.versioning).previous_message_type = | ||
"envoy.config.filter.http.compressor.gzip.v2.Gzip.CompressionLevel"; | ||
|
||
enum Enum { | ||
DEFAULT = 0; | ||
BEST = 1; | ||
SPEED = 2; | ||
} | ||
} | ||
|
||
// Value from 1 to 9 that controls the amount of internal memory used by zlib. Higher values | ||
// use more memory, but are faster and produce better compression results. The default value is 5. | ||
google.protobuf.UInt32Value memory_level = 1 [(validate.rules).uint32 = {lte: 9 gte: 1}]; | ||
|
||
// A value used for selecting the zlib compression level. This setting will affect speed and | ||
// amount of compression applied to the content. "BEST" provides higher compression at the cost of | ||
// higher latency, "SPEED" provides lower compression with minimum impact on response time. | ||
// "DEFAULT" provides an optimal result between speed and compression. This field will be set to | ||
// "DEFAULT" if not specified. | ||
CompressionLevel.Enum compression_level = 3 [(validate.rules).enum = {defined_only: true}]; | ||
|
||
// A value used for selecting the zlib compression strategy which is directly related to the | ||
// characteristics of the content. Most of the time "DEFAULT" will be the best choice, though | ||
// there are situations which changing this parameter might produce better results. For example, | ||
// run-length encoding (RLE) is typically used when the content is known for having sequences | ||
// which same data occurs many consecutive times. For more information about each strategy, please | ||
// refer to zlib manual. | ||
CompressionStrategy compression_strategy = 4 [(validate.rules).enum = {defined_only: true}]; | ||
|
||
// Value from 9 to 15 that represents the base two logarithmic of the compressor's window size. | ||
// Larger window results in better compression at the expense of memory usage. The default is 12 | ||
// which will produce a 4096 bytes window. For more details about this parameter, please refer to | ||
// zlib manual > deflateInit2. | ||
google.protobuf.UInt32Value window_bits = 9 [(validate.rules).uint32 = {lte: 15 gte: 9}]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,23 @@ package envoy.extensions.filters.http.compressor.v3; | |
|
||
import "envoy/config/core/v3/base.proto"; | ||
|
||
import "google/protobuf/any.proto"; | ||
import "google/protobuf/wrappers.proto"; | ||
|
||
import "udpa/annotations/status.proto"; | ||
import "udpa/annotations/versioning.proto"; | ||
import "validate/validate.proto"; | ||
|
||
option java_package = "io.envoyproxy.envoy.extensions.filters.http.compressor.v3"; | ||
option java_outer_classname = "CompressorProto"; | ||
option java_multiple_files = true; | ||
option (udpa.annotations.file_status).package_version_status = NEXT_MAJOR_VERSION_CANDIDATE; | ||
|
||
// [#protodoc-title: Compressor] | ||
// Compressor :ref:`configuration overview <config_http_filters_compressor>`. | ||
// [#extension: envoy.filters.http.compressor] | ||
|
||
// [#next-free-field: 6] | ||
// [#next-free-field: 7] | ||
message Compressor { | ||
option (udpa.annotations.versioning).previous_message_type = | ||
"envoy.config.filter.http.compressor.v2.Compressor"; | ||
|
@@ -46,4 +50,24 @@ message Compressor { | |
// Runtime flag that controls whether the filter is enabled or not. If set to false, the | ||
// filter will operate as a pass-through filter. If not specified, defaults to enabled. | ||
config.core.v3.RuntimeFeatureFlag runtime_enabled = 5; | ||
|
||
// A compressor library to use for compression. Currently only | ||
// :ref:`envoy.filters.http.compressor.gzip<envoy_api_msg_extensions.filters.http.compressor.gzip.v3.Gzip>` | ||
// is included in Envoy. | ||
// | ||
// This field is ignored when used in the context of the deprecated "envoy.filters.http.gzip" | ||
// filter. | ||
CompressorLibrary compressor_library = 6; | ||
} | ||
|
||
message CompressorLibrary { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
option (udpa.annotations.versioning).previous_message_type = | ||
"envoy.config.filter.http.compressor.v2.CompressorLibrary"; | ||
|
||
// The name of the compressor library to instantiate for the filter. | ||
string name = 1 [(validate.rules).string = {min_bytes: 1}]; | ||
|
||
// Compressor library specific configuration. See the supported libraries for further | ||
// documentation. | ||
google.protobuf.Any typed_config = 2; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ HTTP filters | |
*/v2/* | ||
*/v2alpha/* | ||
*/v2alpha1/* | ||
compressor/*/v2/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ HTTP filters | |
|
||
*/empty/* | ||
../../../extensions/filters/http/*/v3/* | ||
../../../extensions/filters/http/compressor/*/v3/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this and line 25 be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the line 27, but 25 is still needed according to
check_format.py fix