@@ -23,6 +23,8 @@ const (
2323// +kubebuilder:resource:categories=envoy-gateway,shortName=btp
2424// +kubebuilder:subresource:status
2525// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
26+ // +genclient
27+ // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
2628type BackendTrafficPolicy struct {
2729 metav1.TypeMeta `json:",inline"`
2830 metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -82,6 +84,7 @@ type BackendTrafficPolicySpec struct {
8284
8385 // The compressor config for the http streams.
8486 // This provides more granular control over compression configuration.
87+ // Order matters: The first compressor in the list is preferred when q-values in Accept-Encoding are equal.
8588 //
8689 // +patchMergeKey=type
8790 // +patchStrategy=merge
@@ -126,6 +129,24 @@ type BackendTelemetry struct {
126129 //
127130 // +optional
128131 Tracing * Tracing `json:"tracing,omitempty"`
132+ // Metrics defines metrics configuration for the backend or Route.
133+ //
134+ // +optional
135+ Metrics * BackendMetrics `json:"metrics,omitempty"`
136+ }
137+
138+ type BackendMetrics struct {
139+ // RouteStatName defines the value of the Route stat_prefix, determining how the route stats are named.
140+ // For more details, see envoy docs: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#config-route-v3-route
141+ // The supported operators for this pattern are:
142+ // %ROUTE_NAME%: name of Gateway API xRoute resource
143+ // %ROUTE_NAMESPACE%: namespace of Gateway API xRoute resource
144+ // %ROUTE_KIND%: kind of Gateway API xRoute resource
145+ // Example: %ROUTE_KIND%/%ROUTE_NAMESPACE%/%ROUTE_NAME% => httproute/my-ns/my-route
146+ // Disabled by default.
147+ //
148+ // +optional
149+ RouteStatName * string `json:"routeStatName,omitempty"`
129150}
130151
131152// ProtocolUpgradeConfig specifies the configuration for protocol upgrades.
@@ -165,12 +186,13 @@ type RequestBuffer struct {
165186// BackendTrafficPolicyList contains a list of BackendTrafficPolicy resources.
166187//
167188// +kubebuilder:object:root=true
189+ // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
168190type BackendTrafficPolicyList struct {
169191 metav1.TypeMeta `json:",inline"`
170192 metav1.ListMeta `json:"metadata,omitempty"`
171193 Items []BackendTrafficPolicy `json:"items"`
172194}
173195
174196func init () {
175- SchemeBuilder .Register (& BackendTrafficPolicy {}, & BackendTrafficPolicyList {})
197+ localSchemeBuilder .Register (& BackendTrafficPolicy {}, & BackendTrafficPolicyList {})
176198}
0 commit comments