Skip to content

The RateLimitPolicy Custom Resource Definition (CRD)

RateLimitPolicy

Field Type Required Description
spec RateLimitPolicySpec Yes The specification for RateLimitPolicy custom resource
status RateLimitPolicyStatus No The status for the custom resource

RateLimitPolicySpec

Field Type Required Description
targetRef LocalPolicyTargetReferenceWithSectionName Yes Reference to a Kubernetes resource that the policy attaches to. For more info
defaults RateLimitPolicyCommonSpec No Default limit definitions. This field is mutually exclusive with the limits field
overrides RateLimitPolicyCommonSpec No Overrides limit definitions. This field is mutually exclusive with the limits field and defaults field. This field is only allowed for policies targeting Gateway in targetRef.kind
limits MapLimit> No Limit definitions. This field is mutually exclusive with the defaults field

LocalPolicyTargetReferenceWithSectionName

Field Type Required Description
LocalPolicyTargetReference LocalPolicyTargetReference Yes Reference to a local policy target.
sectionName SectionName No Section name for further specificity (if needed).

LocalPolicyTargetReference

Field Type Required Description
group Group Yes Group of the target resource.
kind Kind Yes Kind of the target resource.
name ObjectName Yes Name of the target resource.

SectionName

Field Type Required Description
SectionName v1.SectionName (String) Yes SectionName is the name of a section in a Kubernetes resource.
In the following resources, SectionName is interpreted as the following:
Gateway: Listener name
HTTPRoute: HTTPRouteRule name
* Service: Port name
### RateLimitPolicyCommonSpec
Field Type Required Description
when []Predicate No List of dynamic predicates to activate the policy. All expression must evaluate to true for the policy to be applied
limits MapLimit> No Explicit Limit definitions. This field is mutually exclusive with RateLimitPolicySpec limits field

Predicate

Field Type Required Description
predicate String Yes Defines one CEL expression that must be evaluated to bool

Counter

Field Type Required Description
expression String Yes Defines one CEL expression that will be used as rate limiting counter

Limit

Field Type Required Description
rates []RateLimit No List of rate limits associated with the limit definition
counters []Counter No List of rate limit counter qualifiers. Items must be a valid Well-known attribute. Each distinct value resolved in the data plane starts a separate counter for each rate limit.
when []Predicate No List of dynamic predicates to activate the limit. All expression must evaluate to true for the limit to be applied

RateLimit

Field Type Required Description
limit Number Yes Maximum value allowed within the given period of time (duration)
window String Yes The period of time that the limit applies. Follows Gateway API Duration format

RateLimitPolicyStatus

Field Type Description
observedGeneration String Number of the last observed generation of the resource. Use it to check if the status info is up to date with latest resource spec.
conditions []ConditionSpec List of conditions that define that status of the resource.

ConditionSpec

  • The lastTransitionTime field provides a timestamp for when the entity last transitioned from one status to another.
  • The message field is a human-readable message indicating details about the transition.
  • The reason field is a unique, one-word, CamelCase reason for the condition’s last transition.
  • The status field is a string, with possible values True, False, and Unknown.
  • The type field is a string with the following possible values:
    • Available: the resource has successfully configured;
Field Type Description
type String Condition Type
status String Status: True, False, Unknown
reason String Condition state reason
message String Condition state description
lastTransitionTime Timestamp Last transition timestamp