diff --git a/testsuite/openshift/objects/rate_limit.py b/testsuite/openshift/objects/rate_limit.py index ded279cd..352c83fd 100644 --- a/testsuite/openshift/objects/rate_limit.py +++ b/testsuite/openshift/objects/rate_limit.py @@ -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"""