From 65a2be5150829d2fe8daf95ac7b80b71c3bcf8c5 Mon Sep 17 00:00:00 2001 From: jsmolar Date: Mon, 22 May 2023 16:25:23 +0200 Subject: [PATCH] Added configurations for RLP --- testsuite/openshift/objects/rate_limit.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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"""