Skip to content

Commit

Permalink
Added configurations for RLP
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmolar committed Nov 6, 2023
1 parent 407a717 commit 65a2be5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions testsuite/openshift/objects/rate_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ def create_instance(cls, openshift: OpenShiftClient, name, route: Referencable,

return cls(model, context=openshift.context)

@staticmethod
def _user_id_variable(user_id):
"""Add configuration for rate limit."""
return {
"actions": [
{
"metadata": {
"descriptor_key": user_id,
"default_value": "no-user",
"metadata_key": {
"key": "envoy.filters.http.ext_authz",
"path": [{"segment": {"key": "ext_auth_data"}}, {"segment": {"key": user_id}}],
},
}
}
]
}

@modify
def add_limit(self, name, limits: Iterable[Limit], when: Iterable[Rule] = None):
"""Add another limit"""
Expand Down

0 comments on commit 65a2be5

Please sign in to comment.