Skip to content

Commit

Permalink
feat: expose Envoy statistics configuration in gwp
Browse files Browse the repository at this point in the history
Allows configuring Envoy stats_config propety in Gateway Proxy.
  • Loading branch information
jlourenc committed Jul 3, 2023
1 parent d7f795f commit 83d7463
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog/v1.15.0-beta16/gwp-stats-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog:
- type: NON_USER_FACING
description: >-
Allow configuring gateway proxy Envoy statistics configuration.
2 changes: 2 additions & 0 deletions docs/content/reference/values.txt
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@
|gatewayProxies.NAME.istioMetaClusterId|string||ISTIO_META_CLUSTER_ID Environment Variable. Defaults to "Kubernetes"|
|gatewayProxies.NAME.istioDiscoveryAddress|string||discoveryAddress field of the PROXY_CONFIG environment variable. Defaults to "istiod.istio-system.svc:15012"|
|gatewayProxies.NAME.envoyLogLevel|string||Level at which the pod should log. Options include "trace", "info", "debug", "warn", "error", "critical" and "off". Default level is info|
|gatewayProxies.NAME.envoyStatsConfig.NAME|interface||Envoy statistics configuration such as tagging. https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/metrics/v3/stats.proto#config-metrics-v3-statsconfig|
|gatewayProxies.NAME.xdsServiceAddress|string||The k8s service name for the xds server. Defaults to gloo.|
|gatewayProxies.NAME.xdsServicePort|uint32||The k8s service port for the xds server. Defaults to the value from .Values.gloo.deployment.xdsPort, but can be overridden to use, for example, xds-relay.|
|gatewayProxies.NAME.tcpKeepaliveTimeSeconds|uint32||The amount of time in seconds for connections to be idle before sending keep-alive probes. Defaults to 60. See here: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/address.proto#envoy-v3-api-msg-config-core-v3-tcpkeepalive|
Expand Down Expand Up @@ -924,6 +925,7 @@
|gatewayProxies.gatewayProxy.istioMetaClusterId|string||ISTIO_META_CLUSTER_ID Environment Variable. Defaults to "Kubernetes"|
|gatewayProxies.gatewayProxy.istioDiscoveryAddress|string||discoveryAddress field of the PROXY_CONFIG environment variable. Defaults to "istiod.istio-system.svc:15012"|
|gatewayProxies.gatewayProxy.envoyLogLevel|string||Level at which the pod should log. Options include "trace", "info", "debug", "warn", "error", "critical" and "off". Default level is info|
|gatewayProxies.gatewayProxy.envoyStatsConfig.NAME|interface||Envoy statistics configuration such as tagging. https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/metrics/v3/stats.proto#config-metrics-v3-statsconfig|
|gatewayProxies.gatewayProxy.xdsServiceAddress|string||The k8s service name for the xds server. Defaults to gloo.|
|gatewayProxies.gatewayProxy.xdsServicePort|uint32||The k8s service port for the xds server. Defaults to the value from .Values.gloo.deployment.xdsPort, but can be overridden to use, for example, xds-relay.|
|gatewayProxies.gatewayProxy.tcpKeepaliveTimeSeconds|uint32|60|The amount of time in seconds for connections to be idle before sending keep-alive probes. Defaults to 60. See here: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/address.proto#envoy-v3-api-msg-config-core-v3-tcpkeepalive|
Expand Down
1 change: 1 addition & 0 deletions install/helm/gloo/generate/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ type GatewayProxy struct {
IstioMetaClusterId *string `json:"istioMetaClusterId,omitempty" desc:"ISTIO_META_CLUSTER_ID Environment Variable. Defaults to \"Kubernetes\""`
IstioDiscoveryAddress *string `json:"istioDiscoveryAddress,omitempty" desc:"discoveryAddress field of the PROXY_CONFIG environment variable. Defaults to \"istiod.istio-system.svc:15012\""`
EnvoyLogLevel *string `json:"envoyLogLevel,omitempty" desc:"Level at which the pod should log. Options include \"trace\", \"info\", \"debug\", \"warn\", \"error\", \"critical\" and \"off\". Default level is info"`
EnvoyStatsConfig map[string]interface{} `json:"envoyStatsConfig,omitempty" desc:"Envoy statistics configuration such as tagging. https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/metrics/v3/stats.proto#config-metrics-v3-statsconfig"`
XdsServiceAddress *string `json:"xdsServiceAddress,omitempty" desc:"The k8s service name for the xds server. Defaults to gloo."`
XdsServicePort *uint32 `json:"xdsServicePort,omitempty" desc:"The k8s service port for the xds server. Defaults to the value from .Values.gloo.deployment.xdsPort, but can be overridden to use, for example, xds-relay."`
TcpKeepaliveTimeSeconds *uint32 `json:"tcpKeepaliveTimeSeconds,omitempty" desc:"The amount of time in seconds for connections to be idle before sending keep-alive probes. Defaults to 60. See here: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/address.proto#envoy-v3-api-msg-config-core-v3-tcpkeepalive"`
Expand Down
3 changes: 3 additions & 0 deletions install/helm/gloo/templates/9-gateway-proxy-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ data:
# Specifies the proxy's in-memory xds cache key (see projects/gloo/pkg/xds/envoy.go)
# This value needs to match discoveryNamespace (or "writeNamespace") in the settings template
role: {{.Values.settings.writeNamespace | default .Release.Namespace }}~{{ $name | kebabcase }}
{{- if $spec.envoyStatsConfig }}
stats_config: {{- toYaml $spec.envoyStatsConfig | nindent 6}}
{{- end }} {{- /* if $spec.envoyStatsConfig */}}
static_resources:
{{- if or $statsConfig.enabled (or $spec.readConfig $spec.extraListenersHelper) }}
listeners:
Expand Down
20 changes: 20 additions & 0 deletions install/test/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,26 @@ var _ = Describe("Helm Test", func() {
})
})

It("should set stats_config in gateway-proxy-envoy-config from gatewayProxies.gatewayProxy.envoyStatsConfig", func() {
prepareMakefileFromValuesFile("values/val_gwp_envoy_stats_config.yaml")

testManifest.SelectResources(func(resource *unstructured.Unstructured) bool {
return resource.GetKind() == "ConfigMap"
}).ExpectAll(func(configMap *unstructured.Unstructured) {
configMapObject, err := kuberesource.ConvertUnstructured(configMap)
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("ConfigMap %+v should be able to convert from unstructured", configMap))
structuredConfigMap, ok := configMapObject.(*v1.ConfigMap)
Expect(ok).To(BeTrue(), fmt.Sprintf("ConfigMap %+v should be able to cast to a structured config map", configMap))

if structuredConfigMap.GetName() == "gateway-proxy-envoy-config" {
expect := Expect(structuredConfigMap.Data["envoy.yaml"])
expect.To(ContainSubstring("stats_config:"))
expect.To(ContainSubstring("stats_tags:"))
expect.To(ContainSubstring("- fixed_value: zero"))
}
})
})

It("Should have 'pre-install' and 'pre-upgrade' hook if gateway.certGenJob.runOnUpdate is true", func() {
prepareMakefile(namespace, helmValues{
valuesArgs: []string{
Expand Down
6 changes: 6 additions & 0 deletions install/test/values/val_gwp_envoy_stats_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gatewayProxies:
gatewayProxy:
envoyStatsConfig:
stats_tags:
- fixed_value: zero
tag_name: one

0 comments on commit 83d7463

Please sign in to comment.