From f0f72b3b894a24ab19217242228f5eedf9ca9ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 21 Oct 2022 12:17:38 +0300 Subject: [PATCH] Add 410 return code handling --- meta-operator.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta-operator.py b/meta-operator.py index 2ca8886..fb13411 100755 --- a/meta-operator.py +++ b/meta-operator.py @@ -9,6 +9,7 @@ import string import yaml from prometheus_client import Counter, Gauge from kubernetes_asyncio.client.api_client import ApiClient +from kubernetes_asyncio.client.exceptions import ApiException from kubernetes_asyncio import client, config, watch from time import time import argparse @@ -221,6 +222,12 @@ async def main(): try: gauge_watch_stream_begin_timestamp.set(time()) await update_loop(v1, apps_api, api_instance, revision) + except ApiException as e: + logger.debug("Caught exception: %s", e) + if e.status == 410: + pass + else: + raise except asyncio.exceptions.TimeoutError: pass