From b5ce5f3904c35962fd332ba7dd7acef5b9eccb94 Mon Sep 17 00:00:00 2001 From: Robert Stein Date: Tue, 8 Oct 2024 17:46:08 +0200 Subject: [PATCH] chore(#451): no need for docker in `install` command --- client/gefyra/api/install.py | 4 +++- client/gefyra/configuration.py | 24 ++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/client/gefyra/api/install.py b/client/gefyra/api/install.py index b5a47b58..e1799d10 100644 --- a/client/gefyra/api/install.py +++ b/client/gefyra/api/install.py @@ -50,7 +50,9 @@ def install( ) -> str: from gefyra.configuration import ClientConfiguration - config = ClientConfiguration(kube_config_file=kubeconfig, kube_context=kubecontext) + config = ClientConfiguration( + kube_config_file=kubeconfig, kube_context=kubecontext, ignore_docker=True + ) if preset: presetoptions = LB_PRESETS.get(preset) # type: ignore if not presetoptions: diff --git a/client/gefyra/configuration.py b/client/gefyra/configuration.py index d6c142e8..4eb11624 100644 --- a/client/gefyra/configuration.py +++ b/client/gefyra/configuration.py @@ -71,6 +71,7 @@ def __init__( client_id: str = "", gefyra_config_root: Optional[Union[str, Path]] = None, ignore_connection: bool = False, # work with kubeconfig not connection + ignore_docker: bool = False, ): import platform @@ -131,16 +132,19 @@ def __init__( self.CARGO_PROBE_TIMEOUT = 20 # in seconds self.CONTAINER_RUN_TIMEOUT = 10 # in seconds self.CLIENT_ID = client_id - containers = self.DOCKER.containers.list( - all=True, - filters={"label": f"{CONNECTION_NAME_LABEL}={self.CONNECTION_NAME}"}, - ) - if containers and not ignore_connection: - cargo_container = containers[0] - self.CARGO_ENDPOINT = cargo_container.labels.get(CARGO_ENDPOINT_LABEL) - self.KUBE_CONFIG_FILE = cargo_container.labels.get(ACTIVE_KUBECONFIG_LABEL) - self.CLIENT_ID = cargo_container.labels.get(CLIENT_ID_LABEL) - self.CARGO_CONTAINER_NAME = cargo_container.name + if not ignore_docker: + containers = self.DOCKER.containers.list( + all=True, + filters={"label": f"{CONNECTION_NAME_LABEL}={self.CONNECTION_NAME}"}, + ) + if containers and not ignore_connection: + cargo_container = containers[0] + self.CARGO_ENDPOINT = cargo_container.labels.get(CARGO_ENDPOINT_LABEL) + self.KUBE_CONFIG_FILE = cargo_container.labels.get( + ACTIVE_KUBECONFIG_LABEL + ) + self.CLIENT_ID = cargo_container.labels.get(CLIENT_ID_LABEL) + self.CARGO_CONTAINER_NAME = cargo_container.name self.NETWORK_NAME = f"{self.NETWORK_NAME}-{self.CONNECTION_NAME}" if cargo_endpoint_host: