-
Notifications
You must be signed in to change notification settings - Fork 690
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
Adds support for configuration of different types of compression, including none #6546
Open
chaosbox
wants to merge
36
commits into
projectcontour:main
Choose a base branch
from
chaosbox:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,122
−191
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
b4d5b67
build(deps): bump docker/setup-buildx-action from 3.3.0 to 3.4.0 (#6543)
dependabot[bot] 081a47c
Adds "disableCompression" as a feature to turnon/off Envoy's GZIP res…
818ccf0
Merge remote-tracking branch 'upstream/main'
7ddb6f0
This fixes linter nag parameter 'conf' seems to be unused
8df07e2
This fixes linter nag File is not gci-ed with ...
100bf40
This fixes linter nag File is not gci-ed with ...
56e4ee7
This fixes linter nag File is not gofumpt-ed with -extra
548981e
This fixes linter nag File is not gofumpt-ed with -extra
934ca48
Fix table borders
2efb693
Add disableCompression flag to configuration docs.
b0cfe71
add changelog file
72e0e9c
Merge remote-tracking branch 'upstream/main'
geomacy 73c4b67
Merge remote-tracking branch 'upstream/main'
235acc3
Merge remote-tracking branch 'upstream/main'
7e843b7
rework as --compression flag with options gzip, brotli, zstd, disabled
geomacy 36dbadb
Merge pull request #1 from chaosbox/compression-flag
geomacy f7b261b
add validation to crd compression field
b68f0b1
delete unnecessary output log
5dcdc33
define compression with a struct for API extensibility
3d83394
lint fixes
cda9c76
test fix
ff84c37
fix flag handling
5725a53
api lint
630541e
parameters_test
4610b80
update comment
45ea946
fix assertion arg order and bump timeout
98225fc
add some servecontext tests
661b552
add some parameters tests
75f8b7b
Update internal/featuretests/v3/compression_test.go
geomacy 351a820
Update changelogs/unreleased/6546-chaosbox-small.md
geomacy 89060c0
Merge branch 'main' into pr-6546-review-comments
95d38af
remove command flag
366f48d
treat empty string as valid CompressionAlgorithm
1a6465f
update configuration docs per new types
43f6598
lint
2f5e157
rename builder method for clarity
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,53 @@ | ||||||
// Copyright Project Contour Authors | ||||||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
// you may not use this file except in compliance with the License. | ||||||
// You may obtain a copy of the License at | ||||||
// | ||||||
// http://www.apache.org/licenses/LICENSE-2.0 | ||||||
// | ||||||
// Unless required by applicable law or agreed to in writing, software | ||||||
// distributed under the License is distributed on an "AS IS" BASIS, | ||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
// See the License for the specific language governing permissions and | ||||||
// limitations under the License. | ||||||
|
||||||
package v1alpha1 | ||||||
|
||||||
import "fmt" | ||||||
|
||||||
// CompressionAlgorithm defines the type of compression algorithm applied in default HTTP listener filter chain. | ||||||
// Allowable values are defined as names of well known compression algorithms (plus "disabled"). | ||||||
type CompressionAlgorithm string | ||||||
|
||||||
// EnvoyCompression defines configuration related to compression in the default HTTP Listener filter chain. | ||||||
type EnvoyCompression struct { | ||||||
// Algorithm selects the compression type applied in the compression HTTP filter of the default Listener filters. | ||||||
// Values: `gzip` (default), `brotli`, `zstd`, `disabled`. | ||||||
// Setting this to `disabled` will make Envoy skip "Accept-Encoding: gzip,deflate" request header and always return uncompressed response | ||||||
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.
Suggested change
|
||||||
// +kubebuilder:validation:Enum="gzip";"brotli";"zstd";"disabled" | ||||||
// +optional | ||||||
Algorithm CompressionAlgorithm `json:"algorithm,omitempty"` | ||||||
} | ||||||
|
||||||
func (a CompressionAlgorithm) Validate() error { | ||||||
switch a { | ||||||
case BrotliCompression, DisabledCompression, GzipCompression, ZstdCompression, "": | ||||||
return nil | ||||||
default: | ||||||
return fmt.Errorf("invalid compression type: %q", a) | ||||||
} | ||||||
} | ||||||
|
||||||
const ( | ||||||
// BrotliCompression specifies brotli as the default HTTP filter chain compression mechanism | ||||||
BrotliCompression CompressionAlgorithm = "brotli" | ||||||
|
||||||
// DisabledCompression specifies that there will be no compression in the default HTTP filter chain | ||||||
DisabledCompression CompressionAlgorithm = "disabled" | ||||||
|
||||||
// GzipCompression specifies gzip as the default HTTP filter chain compression mechanism | ||||||
GzipCompression CompressionAlgorithm = "gzip" | ||||||
|
||||||
// ZstdCompression specifies zstd as the default HTTP filter chain compression mechanism | ||||||
ZstdCompression CompressionAlgorithm = "zstd" | ||||||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright Project Contour Authors | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package v1alpha1_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
contour_v1alpha1 "github.com/projectcontour/contour/apis/projectcontour/v1alpha1" | ||
) | ||
|
||
func TestValidateEnvoyCompressionAlgorithmType(t *testing.T) { | ||
require.Error(t, contour_v1alpha1.CompressionAlgorithm("foo").Validate()) | ||
|
||
require.NoError(t, contour_v1alpha1.CompressionAlgorithm("").Validate()) | ||
require.NoError(t, contour_v1alpha1.BrotliCompression.Validate()) | ||
require.NoError(t, contour_v1alpha1.DisabledCompression.Validate()) | ||
require.NoError(t, contour_v1alpha1.GzipCompression.Validate()) | ||
require.NoError(t, contour_v1alpha1.ZstdCompression.Validate()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The HTTP compression algorithm can now be configured using the `compression.algorithm` field in the configuration file or the `spec.envoy.listener.compression.algorithm` field in the `ContourConfiguration` CRD. The available values are `gzip` (default), `brotli`, `zstd`, and `disabled`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.