Skip to content

RateLimitPolicy

Package v1alpha1 contains the API Schema definitions for WSO2 APK.

Rate Limit Policy

RateLimitPolicy is the Schema for the ratelimitpolicies API

Field Description
apiVersion
string
dp.wso2.com/v1alpha1
kind
string
RateLimitPolicy
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of the metadata field.
spec
RateLimitPolicySpec


default
RateLimitAPIPolicy
override
RateLimitAPIPolicy
targetRef
sigs.k8s.io/gateway-api/apis/v1alpha2.PolicyTargetReference
status
RateLimitPolicyStatus

APIRateLimitPolicy

(Appears on: RateLimitAPIPolicy)

APIRateLimitPolicy defines the desired state of APIPolicy

Field Description
requestsPerUnit
uint32

RequestPerUnit is the number of requests allowed per unit time

unit
string

Unit is the unit of the requestsPerUnit

CustomRateLimitPolicy

(Appears on: RateLimitAPIPolicy)

CustomRateLimitPolicy defines the desired state of CustomPolicy

Field Description
requestsPerUnit
uint32

RequestPerUnit is the number of requests allowed per unit time

unit
string

Unit is the unit of the requestsPerUnit

key
string

Key is the key of the custom policy

value
string
(Optional)

Value is the value of the custom policy

organization
string

Organization is the organization of the policy

RateLimitAPIPolicy

(Appears on: RateLimitPolicySpec)

RateLimitAPIPolicy defines the desired state of Policy

Field Description
api
APIRateLimitPolicy
(Optional)

API level ratelimit policy

custom
CustomRateLimitPolicy
(Optional)

Custom ratelimit policy

RateLimitPolicySpec

(Appears on: RateLimitPolicy)

RateLimitPolicySpec defines the desired state of RateLimitPolicy

Field Description
default
RateLimitAPIPolicy
override
RateLimitAPIPolicy
targetRef
sigs.k8s.io/gateway-api/apis/v1alpha2.PolicyTargetReference

RateLimitPolicyStatus

(Appears on: RateLimitPolicy)

RateLimitPolicyStatus defines the observed state of RateLimitPolicy


Generated with gen-crd-api-reference-docs.

Rate Limiter Samples

RateLimitPolicy for API

The following defines a rate limiting policy at the API-level.

apiVersion: dp.wso2.com/v1alpha1
kind: RateLimitPolicy
metadata:
  name: sand-http-bin-ratelimit
spec:
  default:
    api:
      requestsPerUnit: 5
      unit: Minute
  targetRef:
    kind: API
    name: http-bin-api
    group: gateway.networking.k8s.io

Rate Limit for Resource

The following defines a rate limiting policy at the Resource (HTTPRoute) level.

apiVersion: dp.wso2.com/v1alpha1
kind: RateLimitPolicy
metadata:
  name: sand-http-bin-ratelimit
spec:
  override:
    api:
      requestsPerUnit: 5
      unit: Minute
  targetRef:
    kind: Resource
    name: sand-http-route-http-bin-api
    group: gateway.networking.k8s.io

Custom Rate Limit Policy

The following defines a custom rate limiting policy.

apiVersion: dp.wso2.com/v1alpha1
kind: RateLimitPolicy
metadata:
  name: http-bin-ratelimit-usergroup
spec:
  override:
    custom:
      key: org_key
      value: admin
      requestsPerUnit: 20
      unit: Minute
      organization: default
  targetRef:
    kind: Gateway
    name: default
    group: gateway.networking.k8s.io

Refer the Rate Limit documentation for more information on how to configure rate limit policies.