From 45fd96a2ef9e5806af0cca5b65c5fe2d4d4d344c Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Tue, 20 Aug 2024 10:46:16 +1000 Subject: [PATCH] Convert to Operator object before matching. --- lookup-service/service/caches/tenants.py | 1 + lookup-service/service/helpers/selectors.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lookup-service/service/caches/tenants.py b/lookup-service/service/caches/tenants.py index 241e6e1e..aa69cdfe 100644 --- a/lookup-service/service/caches/tenants.py +++ b/lookup-service/service/caches/tenants.py @@ -47,6 +47,7 @@ def allowed_access_to_portal(self, portal: TrainingPortal) -> bool: resource = { "metadata": { "name": portal.name, + "uid": portal.uid, "labels": {item["name"]: item["value"] for item in list(portal.labels)}, }, } diff --git a/lookup-service/service/helpers/selectors.py b/lookup-service/service/helpers/selectors.py index 29e41f36..2235ac83 100644 --- a/lookup-service/service/helpers/selectors.py +++ b/lookup-service/service/helpers/selectors.py @@ -115,7 +115,9 @@ def convert_to_label_selector(label_selector_dict: dict) -> LabelSelector: match_expressions = [ LabelSelectorRequirement( - key=expr["key"], operator=expr["operator"], values=expr.get("values") + key=expr["key"], + operator=Operator(expr["operator"]), + values=expr.get("values"), ) for expr in match_expressions_data ]