From ae94edc14aeb3601595d6ed0110ce58f61c78255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madis=20M=C3=A4gi?= Date: Fri, 13 Oct 2023 15:13:17 +0300 Subject: [PATCH] Dont add finalizer --- app/app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/app.py b/app/app.py index 7c4144c..9a63105 100755 --- a/app/app.py +++ b/app/app.py @@ -11,6 +11,9 @@ devenv = bool(os.getenv("DEV_ENV", False)) api_key = os.environ["API_KEY"] users_lookup = {} +def resource_is_deleted(event, **_): + return event["type"] == "DELETED" + def authorized(): def decorator(f): @wraps(f) @@ -66,7 +69,7 @@ async def save_handler(body, **_): print(f"Saving {username}") users_lookup[username] = user -@kopf.on.delete('oidcgatewayusers') +@kopf.on.event('', 'v1', 'oidcgatewayusers', when=resource_is_deleted) async def delete_handler(body, **_): username = body['metadata']['name'] print(f"Deleting {username}")