You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api/v1alpha1/ratelimit_types.go
+86Lines changed: 86 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,7 @@ type LocalRateLimit struct {
62
62
//
63
63
// +optional
64
64
// +kubebuilder:validation:MaxItems=16
65
+
// +kubebuilder:validation:XValidation:rule="self.all(foo, !has(foo.cost) || !has(foo.cost.response))", message="response cost is not supported for Local Rate Limits"
65
66
Rules []RateLimitRule`json:"rules"`
66
67
}
67
68
@@ -91,6 +92,91 @@ type RateLimitRule struct {
91
92
// 429 HTTP status code is sent back to the client when
92
93
// the selected requests have reached the limit.
93
94
LimitRateLimitValue`json:"limit"`
95
+
// Cost specifies the cost of requests and responses for the rule.
96
+
//
97
+
// This is optional and if not specified, the default behavior is to reduce the rate limit counters by 1 on
98
+
// the request path and do not reduce the rate limit counters on the response path.
99
+
//
100
+
// +optional
101
+
// +notImplementedHide
102
+
Cost*RateLimitCost`json:"cost,omitempty"`
103
+
}
104
+
105
+
typeRateLimitCoststruct {
106
+
// Request specifies the number to reduce the rate limit counters
107
+
// on the request path. If this is not specified, the default behavior
108
+
// is to reduce the rate limit counters by 1.
109
+
//
110
+
// When Envoy receives a request that matches the rule, it tries to reduce the
111
+
// rate limit counters by the specified number. If the counter doesn't have
0 commit comments