Skip to content

Commit

Permalink
Replace gzip, use compressor filter
Browse files Browse the repository at this point in the history
Ref: c326e8ae2ddf15f4d89aab954adb48618484cb99
  • Loading branch information
chintan8saaras committed Aug 5, 2021
1 parent 4783337 commit b409b0f
Showing 2 changed files with 31 additions and 4 deletions.
17 changes: 15 additions & 2 deletions enroute-dp/internal/envoy/listener_filter_helper.go
Original file line number Diff line number Diff line change
@@ -12,6 +12,10 @@ import (
"github.com/saarasio/enroute/enroute-dp/internal/dag"
cfg "github.com/saarasio/enroute/enroute-dp/saarasconfig"
"github.com/saarasio/enroute/enroute-dp/saarasfilters"
http "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
envoy_compressor_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/compressor/v3"
envoy_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
"github.com/golang/protobuf/ptypes/any"
)

func DagFilterToHttpFilter(df *dag.HttpFilter, vh *dag.VirtualHost) *envoy_extensions_filters_network_http_connection_manager_v3.HttpFilter {
@@ -95,8 +99,17 @@ func httpFilters(vh *dag.Vertex) []*envoy_extensions_filters_network_http_connec

http_filters = append(http_filters,
&envoy_extensions_filters_network_http_connection_manager_v3.HttpFilter{
Name: wellknown.Gzip,
ConfigType: nil,
Name: "compressor",
ConfigType: &http.HttpFilter_TypedConfig{
TypedConfig: toAny(&envoy_compressor_v3.Compressor{
CompressorLibrary: &envoy_core_v3.TypedExtensionConfig{
Name: "gzip",
TypedConfig: &any.Any{
TypeUrl: cfg.HTTPFilterGzip,
},
},
}),
},
})

http_filters = append(http_filters,
18 changes: 16 additions & 2 deletions enroute-dp/internal/envoy/listener_test.go
Original file line number Diff line number Diff line change
@@ -34,6 +34,11 @@ import (
"google.golang.org/protobuf/testing/protocmp"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"
http "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3"
envoy_compressor_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/compressor/v3"
envoy_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
"github.com/golang/protobuf/ptypes/any"
cfg "github.com/saarasio/enroute/enroute-dp/saarasconfig"
)

func TestListener(t *testing.T) {
@@ -247,8 +252,17 @@ func TestHTTPConnectionManager(t *testing.T) {
},
},
HttpFilters: []*envoy_extensions_filters_network_http_connection_manager_v3.HttpFilter{{
Name: wellknown.Gzip,
ConfigType: nil,
Name: "compressor",
ConfigType: &http.HttpFilter_TypedConfig{
TypedConfig: toAny(&envoy_compressor_v3.Compressor{
CompressorLibrary: &envoy_core_v3.TypedExtensionConfig{
Name: "gzip",
TypedConfig: &any.Any{
TypeUrl: cfg.HTTPFilterGzip,
},
},
}),
},
}, {
Name: wellknown.GRPCWeb,
ConfigType: nil,

0 comments on commit b409b0f

Please sign in to comment.