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

feat: expose stats tags in gateway-proxy stats config #8333

Merged
merged 5 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions changelog/v1.15.0-beta17/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"`
sheidkamp marked this conversation as resolved.
Show resolved Hide resolved
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
27 changes: 27 additions & 0 deletions install/test/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down