-
Notifications
You must be signed in to change notification settings - Fork 689
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 3 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
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
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
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
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
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,121 @@ | ||
// 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 v3 | ||
|
||
import ( | ||
envoy_service_discovery_v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" | ||
core_v1 "k8s.io/api/core/v1" | ||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"testing" | ||
|
||
contour_v1 "github.com/projectcontour/contour/apis/projectcontour/v1" | ||
contour_v1alpha1 "github.com/projectcontour/contour/apis/projectcontour/v1alpha1" | ||
envoy_v3 "github.com/projectcontour/contour/internal/envoy/v3" | ||
"github.com/projectcontour/contour/internal/fixture" | ||
xdscache_v3 "github.com/projectcontour/contour/internal/xdscache/v3" | ||
) | ||
geomacy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
func TestDefaultCompression(t *testing.T) { | ||
withDefaultListenerConfig := func(conf *xdscache_v3.ListenerConfig) { | ||
} | ||
|
||
rh, c, done := setup(t, withDefaultListenerConfig) | ||
geomacy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
defer done() | ||
|
||
s1 := fixture.NewService("backend"). | ||
WithPorts(core_v1.ServicePort{Name: "http", Port: 80}) | ||
rh.OnAdd(s1) | ||
|
||
hp1 := &contour_v1.HTTPProxy{ | ||
ObjectMeta: meta_v1.ObjectMeta{ | ||
Name: "simple", | ||
Namespace: s1.Namespace, | ||
}, | ||
Spec: contour_v1.HTTPProxySpec{ | ||
VirtualHost: &contour_v1.VirtualHost{ | ||
Fqdn: "example.com", | ||
}, | ||
Routes: []contour_v1.Route{{ | ||
Conditions: matchconditions(prefixMatchCondition("/")), | ||
Services: []contour_v1.Service{{ | ||
Name: s1.Name, | ||
Port: 80, | ||
}}, | ||
}}, | ||
}, | ||
} | ||
rh.OnAdd(hp1) | ||
|
||
httpListener := defaultHTTPListener() | ||
httpListener.FilterChains = envoy_v3.FilterChains(envoy_v3.HTTPConnectionManagerBuilder(). | ||
RouteConfigName(xdscache_v3.ENVOY_HTTP_LISTENER). | ||
MetricsPrefix(xdscache_v3.ENVOY_HTTP_LISTENER). | ||
AccessLoggers(envoy_v3.FileAccessLogEnvoy(xdscache_v3.DEFAULT_HTTP_ACCESS_LOG, "", nil, contour_v1alpha1.LogLevelInfo)). | ||
DefaultFilters(). | ||
Get(), | ||
) | ||
|
||
c.Request(listenerType, xdscache_v3.ENVOY_HTTP_LISTENER).Equals(&envoy_service_discovery_v3.DiscoveryResponse{ | ||
TypeUrl: listenerType, | ||
Resources: resources(t, httpListener), | ||
}) | ||
} | ||
|
||
func TestDisableCompression(t *testing.T) { | ||
withDisableCompression := func(conf *xdscache_v3.ListenerConfig) { | ||
conf.DisableCompression = true | ||
} | ||
|
||
rh, c, done := setup(t, withDisableCompression) | ||
defer done() | ||
|
||
s1 := fixture.NewService("backend"). | ||
WithPorts(core_v1.ServicePort{Name: "http", Port: 80}) | ||
rh.OnAdd(s1) | ||
|
||
hp1 := &contour_v1.HTTPProxy{ | ||
ObjectMeta: meta_v1.ObjectMeta{ | ||
Name: "simple", | ||
Namespace: s1.Namespace, | ||
}, | ||
Spec: contour_v1.HTTPProxySpec{ | ||
VirtualHost: &contour_v1.VirtualHost{ | ||
Fqdn: "example.com", | ||
}, | ||
Routes: []contour_v1.Route{{ | ||
Conditions: matchconditions(prefixMatchCondition("/")), | ||
Services: []contour_v1.Service{{ | ||
Name: s1.Name, | ||
Port: 80, | ||
}}, | ||
}}, | ||
}, | ||
} | ||
rh.OnAdd(hp1) | ||
|
||
httpListener := defaultHTTPListener() | ||
httpListener.FilterChains = envoy_v3.FilterChains(envoy_v3.HTTPConnectionManagerBuilder(). | ||
DisableCompression(true). | ||
RouteConfigName(xdscache_v3.ENVOY_HTTP_LISTENER). | ||
MetricsPrefix(xdscache_v3.ENVOY_HTTP_LISTENER). | ||
AccessLoggers(envoy_v3.FileAccessLogEnvoy(xdscache_v3.DEFAULT_HTTP_ACCESS_LOG, "", nil, contour_v1alpha1.LogLevelInfo)). | ||
DefaultFilters(). | ||
Get(), | ||
) | ||
|
||
c.Request(listenerType, xdscache_v3.ENVOY_HTTP_LISTENER).Equals(&envoy_service_discovery_v3.DiscoveryResponse{ | ||
TypeUrl: listenerType, | ||
Resources: resources(t, httpListener), | ||
}) | ||
} |
Oops, something went wrong.
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.