diff --git a/changelog/v1.15.0-beta18/gwp-stats-config.yaml b/changelog/v1.15.0-beta18/gwp-stats-config.yaml new file mode 100644 index 00000000000..7079d873190 --- /dev/null +++ b/changelog/v1.15.0-beta18/gwp-stats-config.yaml @@ -0,0 +1,4 @@ +changelog: +- type: NON_USER_FACING + description: >- + Allow configuring gateway proxy Envoy statistics configuration diff --git a/docs/content/reference/values.txt b/docs/content/reference/values.txt index a8744e6ec12..0f92383ccc1 100644 --- a/docs/content/reference/values.txt +++ b/docs/content/reference/values.txt @@ -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. For more info, see 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| @@ -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. For more info, see 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| diff --git a/install/helm/gloo/generate/values.go b/install/helm/gloo/generate/values.go index 26a75ed2998..869306bf21f 100644 --- a/install/helm/gloo/generate/values.go +++ b/install/helm/gloo/generate/values.go @@ -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. For more info, see 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"` diff --git a/install/helm/gloo/templates/9-gateway-proxy-configmap.yaml b/install/helm/gloo/templates/9-gateway-proxy-configmap.yaml index efa887d4323..b375c960dc7 100644 --- a/install/helm/gloo/templates/9-gateway-proxy-configmap.yaml +++ b/install/helm/gloo/templates/9-gateway-proxy-configmap.yaml @@ -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: diff --git a/install/test/helm_test.go b/install/test/helm_test.go index 3b2e526302f..18ab3539c26 100644 --- a/install/test/helm_test.go +++ b/install/test/helm_test.go @@ -802,6 +802,33 @@ var _ = Describe("Helm Test", func() { }) }) + It("should set stats_config in gateway-proxy-envoy-config from gatewayProxies.gatewayProxy.envoyStatsConfig", func() { + prepareMakefile(namespace, helmValues{ + valuesArgs: []string{ + "gatewayProxies.gatewayProxy.envoyStatsConfig.stats_tags[0].fixed_value=zero", + "gatewayProxies.gatewayProxy.envoyStatsConfig.stats_tags[0].tag_name=one", + }, + }) + + resources := testManifest.SelectResources(func(resource *unstructured.Unstructured) bool { + return resource.GetKind() == "ConfigMap" && resource.GetName() == "gateway-proxy-envoy-config" + }) + + Expect(resources.NumResources()).To(Equal(1), "Should find only one gateway-proxy-envoy-config ConfigMap") + + resources.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)) + + 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{