Skip to content

Commit

Permalink
more on the doc
Browse files Browse the repository at this point in the history
Signed-off-by: Takeshi Yoneda <[email protected]>
  • Loading branch information
mathetake committed Dec 23, 2024
1 parent 5003398 commit efc5b87
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 13 deletions.
15 changes: 12 additions & 3 deletions api/v1alpha1/ratelimit_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ type RateLimitRule struct {
// If there's no such metadata or the number stored in the metadata is invalid, it will use the default
// usage number of 1.
//
// This default behavior can be overridden by specifying one of the fields in this RateLimitUsage.
// This default behavior can be overridden by specifying exactly one of the fields in this RateLimitUsage.
// If either of the fields is not specified, Envoy will use the default behavior described above.
//
// See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto.html#config-route-v3-ratelimit-hitsaddend
// for more information.
//
// +kubebuilder:validation:XValidation:rule="!(has(self.number) && has(self.format))",message="only one of number or format can be specified"
type RateLimitHitsAddend struct {
Expand All @@ -133,8 +137,13 @@ type RateLimitHitsAddend struct {
// +optional
// +notImplementedHide
Number *uint64 `json:"number,omitempty"`
// Format specifies the format of the usage number. See the Envoy documentation for the supported formats:
// https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto.html#config-route-v3-ratelimit-hitsaddend
// Format specifies the format of the usage number. See the Envoy documentation for the supported format which
// is the same as the access log format:
// https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-format
//
// For example `%DYNAMIC_METADATA(com.test.my_filter:test_key)%"` will retrieve the usage number from the
// `com.test.my_filter` filter metadata namespace with the key `test_key`.
// Another example is `%BYTES_RECEIVED%` which will retrieve the usage number from the bytes received by the client.
//
// +optional
// +notImplementedHide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,13 @@ spec:
properties:
format:
description: |-
Format specifies the format of the usage number. See the Envoy documentation for the supported formats:
https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto.html#config-route-v3-ratelimit-hitsaddend
Format specifies the format of the usage number. See the Envoy documentation for the supported format which
is the same as the access log format:
https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-format
For example `%DYNAMIC_METADATA(com.test.my_filter:test_key)%"` will retrieve the usage number from the
`com.test.my_filter` filter metadata namespace with the key `test_key`.
Another example is `%BYTES_RECEIVED%` which will retrieve the usage number from the bytes received by the client.
type: string
number:
description: Number specifies the fixed usage number
Expand All @@ -817,8 +822,13 @@ spec:
properties:
format:
description: |-
Format specifies the format of the usage number. See the Envoy documentation for the supported formats:
https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto.html#config-route-v3-ratelimit-hitsaddend
Format specifies the format of the usage number. See the Envoy documentation for the supported format which
is the same as the access log format:
https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-format
For example `%DYNAMIC_METADATA(com.test.my_filter:test_key)%"` will retrieve the usage number from the
`com.test.my_filter` filter metadata namespace with the key `test_key`.
Another example is `%BYTES_RECEIVED%` which will retrieve the usage number from the bytes received by the client.
type: string
number:
description: Number specifies the fixed usage number
Expand Down Expand Up @@ -976,8 +986,13 @@ spec:
properties:
format:
description: |-
Format specifies the format of the usage number. See the Envoy documentation for the supported formats:
https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto.html#config-route-v3-ratelimit-hitsaddend
Format specifies the format of the usage number. See the Envoy documentation for the supported format which
is the same as the access log format:
https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-format
For example `%DYNAMIC_METADATA(com.test.my_filter:test_key)%"` will retrieve the usage number from the
`com.test.my_filter` filter metadata namespace with the key `test_key`.
Another example is `%BYTES_RECEIVED%` which will retrieve the usage number from the bytes received by the client.
type: string
number:
description: Number specifies the fixed usage number
Expand All @@ -1004,8 +1019,13 @@ spec:
properties:
format:
description: |-
Format specifies the format of the usage number. See the Envoy documentation for the supported formats:
https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto.html#config-route-v3-ratelimit-hitsaddend
Format specifies the format of the usage number. See the Envoy documentation for the supported format which
is the same as the access log format:
https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#config-access-log-format
For example `%DYNAMIC_METADATA(com.test.my_filter:test_key)%"` will retrieve the usage number from the
`com.test.my_filter` filter metadata namespace with the key `test_key`.
Another example is `%BYTES_RECEIVED%` which will retrieve the usage number from the bytes received by the client.
type: string
number:
description: Number specifies the fixed usage number
Expand Down
7 changes: 6 additions & 1 deletion site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3364,7 +3364,12 @@ If there's no such metadata or the number stored in the metadata is invalid, it
usage number of 1.


This default behavior can be overridden by specifying one of the fields in this RateLimitUsage.
This default behavior can be overridden by specifying exactly one of the fields in this RateLimitUsage.
If either of the fields is not specified, Envoy will use the default behavior described above.


See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto.html#config-route-v3-ratelimit-hitsaddend
for more information.

_Appears in:_
- [RateLimitRule](#ratelimitrule)
Expand Down
7 changes: 6 additions & 1 deletion site/content/zh/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3364,7 +3364,12 @@ If there's no such metadata or the number stored in the metadata is invalid, it
usage number of 1.


This default behavior can be overridden by specifying one of the fields in this RateLimitUsage.
This default behavior can be overridden by specifying exactly one of the fields in this RateLimitUsage.
If either of the fields is not specified, Envoy will use the default behavior described above.


See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto.html#config-route-v3-ratelimit-hitsaddend
for more information.

_Appears in:_
- [RateLimitRule](#ratelimitrule)
Expand Down

0 comments on commit efc5b87

Please sign in to comment.