From 24898122985cda31390d606df0a039efbbafee27 Mon Sep 17 00:00:00 2001 From: liquidiert Date: Thu, 19 Dec 2024 10:19:18 +0100 Subject: [PATCH] fix: get workload type with utils func and remove daemonset --- client/gefyra/api/bridge.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/client/gefyra/api/bridge.py b/client/gefyra/api/bridge.py index 8856be75..5b9c6dbf 100644 --- a/client/gefyra/api/bridge.py +++ b/client/gefyra/api/bridge.py @@ -10,7 +10,7 @@ from gefyra.types import GefyraBridge -from .utils import stopwatch, wrap_bridge +from .utils import get_workload_type, stopwatch, wrap_bridge logger = logging.getLogger(__name__) @@ -67,14 +67,11 @@ def check_workloads( # Validate workload and probes api = config.K8S_APP_API try: - if workload_type == "deployment": + reconstructed_workload_type = get_workload_type(workload_type) + if reconstructed_workload_type == "deployment": workload = api.read_namespaced_deployment(workload_name, namespace) - elif workload_type == "statefulset": + elif reconstructed_workload_type == "statefulset": workload = api.read_namespaced_stateful_set(workload_name, namespace) - elif workload_type == "daemonset": - workload = api.read_namespaced_daemon_set(workload_name, namespace) - else: - raise RuntimeError(f"Unsupported workload type: {workload_type}") except ApiException as e: raise RuntimeError( f"Error fetching workload {workload_type}/{workload_name}: {e}"