Skip to content

Commit

Permalink
chore(#451): no need for docker in install command
Browse files Browse the repository at this point in the history
  • Loading branch information
SteinRobert committed Oct 8, 2024
1 parent fe42cd2 commit b5ce5f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
4 changes: 3 additions & 1 deletion client/gefyra/api/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 14 additions & 10 deletions client/gefyra/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b5ce5f3

Please sign in to comment.