Skip to content
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

DO NOT MERGE Expose disable dynamic stats (#9260) #9279

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
changelog:
- type: NEW_FEATURE
issueLink: https://github.com/solo-io/gloo/pull/9260
resolvesIssue: false
description: >-
Expose the `dynamic_stats` option on the Envoy router. This flag is only
intended to be used for benchmarking purposes - it is NOT RECOMMENDED to
set this in production.

For more information, see https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/http/router/v3/router.proto

2 changes: 2 additions & 0 deletions docs/content/guides/dev/setting-up-dev-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ On macOS:
xcode-select --install

# install protoc
# note that you can also try simply running `make install-protoc` instead of running the below instructions
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-osx-x86_64.zip
unzip protoc-3.6.1-osx-x86_64.zip
sudo mv bin/protoc /usr/local/bin/
Expand All @@ -46,6 +47,7 @@ On Debian/Ubuntu linux:
sudo apt install make unzip build-essential -y

# install protoc
# note that you can also try simply running `make install-protoc` instead of running the below instructions
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip
unzip protoc-3.6.1-linux-x86_64.zip
sudo mv bin/protoc /usr/local/bin/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions install/helm/gloo/crds/gateway.solo.io_v1_Gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,9 @@ spec:
type: object
router:
properties:
dynamicStats:
nullable: true
type: boolean
suppressEnvoyHeaders:
nullable: true
type: boolean
Expand Down Expand Up @@ -3088,6 +3091,9 @@ spec:
type: object
router:
properties:
dynamicStats:
nullable: true
type: boolean
suppressEnvoyHeaders:
nullable: true
type: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,9 @@ spec:
type: object
router:
properties:
dynamicStats:
nullable: true
type: boolean
suppressEnvoyHeaders:
nullable: true
type: boolean
Expand Down
9 changes: 8 additions & 1 deletion projects/gloo/api/v1/options/router/router.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ import "google/protobuf/wrappers.proto";
message Router{
// Do not add any additional x-envoy- headers to requests or responses. This only affects the router filter generated x-envoy- headers, other Envoy filters and the HTTP connection manager may continue to set x-envoy- headers.
google.protobuf.BoolValue suppress_envoy_headers = 1;
}

// Whether dynamic stats should be enabled or disabled. If not set, or if
// set to true, dynamic stats will be enabled. Otherwise, if set to false,
// dynamic stats will be disabled. It is strongly recommended to leave this
// in the default state in production - it should only be set to false in
// very specific benchmarking or profiling scenarios.
google.protobuf.BoolValue dynamic_stats = 2;
}
51 changes: 35 additions & 16 deletions projects/gloo/pkg/api/v1/options/router/router.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 0 additions & 43 deletions projects/gloo/pkg/translator/listener_subsystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/solo-io/gloo/projects/gloo/pkg/api/v1/options/cors"
"github.com/solo-io/gloo/projects/gloo/pkg/api/v1/options/hcm"
"github.com/solo-io/gloo/projects/gloo/pkg/api/v1/options/protocol_upgrade"
routerV1 "github.com/solo-io/gloo/projects/gloo/pkg/api/v1/options/router"
"github.com/solo-io/gloo/projects/gloo/pkg/api/v1/ssl"
"github.com/solo-io/gloo/projects/gloo/pkg/defaults"
"github.com/solo-io/gloo/projects/gloo/pkg/plugins"
Expand Down Expand Up @@ -175,48 +174,6 @@ var _ = Describe("Listener Subsystem", func() {
ExpectWithOffset(1, routeConfig.GetName()).To(Equal(hcmRouteConfigName))
},
),
Entry(
"Add suppress envoy headers to the router",
&v1.AggregateListener{
HttpResources: &v1.AggregateListener_HttpResources{
HttpOptions: map[string]*v1.HttpListenerOptions{
"http-options-ref": {
HttpConnectionManagerSettings: &hcm.HttpConnectionManagerSettings{},
Router: &routerV1.Router{
SuppressEnvoyHeaders: &wrappers.BoolValue{
Value: true,
},
},
},
},
VirtualHosts: map[string]*v1.VirtualHost{
"vhost-ref": {
Name: "virtual-host",
},
},
},
HttpFilterChains: []*v1.AggregateListener_HttpFilterChain{{
Matcher: nil,
HttpOptionsRef: "http-options-ref",
VirtualHostRefs: []string{"vhost-ref"},
}},
},
func(listener *envoy_config_listener_v3.Listener, routeConfigs []*envoy_config_route_v3.RouteConfiguration) {
By("Should be able to add and translate the router to an envoy config")
filterChain := listener.GetFilterChains()[0]
hcmFilter := filterChain.GetFilters()[0]
_, err := sslutils.AnyToMessage(hcmFilter.GetConfigType().(*envoy_config_listener_v3.Filter_TypedConfig).TypedConfig)
Expect(err).NotTo(HaveOccurred())

hcm := &envoy_http_connection_manager_v3.HttpConnectionManager{}
err = translator.ParseTypedConfig(hcmFilter, hcm)
Expect(err).NotTo(HaveOccurred())
Expect(hcm.HttpFilters).To(HaveLen(2))

routeFilter := hcm.GetHttpFilters()[1]
Expect(routeFilter).To(MatchRegexp("suppress_envoy_headers:true"))
},
),
Entry(
"1 secure filter chain",
&v1.AggregateListener{
Expand Down
4 changes: 4 additions & 0 deletions projects/gloo/pkg/translator/network_filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,14 @@ func (h *hcmNetworkFilterTranslator) computeHttpFilters(params plugins.Params) [
// as the terminal filter in Gloo Edge.
routerV3 := routerv3.Router{}

// TODO it would be ideal of SuppressEnvoyHeaders and DynamicStats could be moved out of here set
// in a separate router plugin
if h.listener.GetOptions().GetRouter().GetSuppressEnvoyHeaders().GetValue() {
routerV3.SuppressEnvoyHeaders = true
}

routerV3.DynamicStats = h.listener.GetOptions().GetRouter().GetDynamicStats()

newStagedFilter, err := plugins.NewStagedFilter(
wellknown.Router,
&routerV3,
Expand Down
Loading
Loading