Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions getdeck/cli/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ def run_deck( # noqa: C901
progress_callback(10)

# 1.b check or set up local cluster
cluster_created = cluster.start_or_create()
if not ignore_cluster:
logger.info("Cluster already exists, starting it")
cluster_created = cluster.start_or_create()
else:
cluster_created = False

if progress_callback:
progress_callback(20)
Expand Down Expand Up @@ -111,13 +115,9 @@ def run_deck( # noqa: C901
if progress_callback:
progress_callback(max(50, int(i / total * 50) - 1))
except Exception as e:
logger.error(
"There was an error installing the workload. Now removing the cluster."
)
logger.error("There was an error installing the workload.")
if cluster_created:
# if cluster.kubernetes_cluster_type == ProviderType.BEIBOOT:
# config.kubeconfig = _old_kubeconfig
# config._init_kubeapi()
logger.info("Now removing the cluster.")
# remove this just created cluster as it probably is in an inconsistent state from the beginning
remove.remove_cluster(deckfile_location, cluster.get_config())
raise e
Expand All @@ -129,7 +129,7 @@ def run_deck( # noqa: C901
ingress_rules = get_ingress_rules(cluster.get_config(), generated_deck.namespace)
if ingress_rules:
for host, path in ingress_rules:
logger.info(f"Ingress: {host} -> {path}")
logger.info(f"Ingress: http://{host} -> {path}")
handle_hosts_resolution(deckfile_location, data_aux.deckfile, deck_name)
logger.info(f"Published ports are: {cluster.get_ports()}")
if notes := data_aux.deckfile.get_deck(deck_name).notes:
Expand Down
3 changes: 3 additions & 0 deletions getdeck/cli/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def remove_cluster(
)

if cluster.exists():
logger.info(
f"Deleting the {cluster.provider_type} cluster with name {cluster.cluster_name}"
)
cluster.delete()
else:
logger.info("Cluster does not exist")
Expand Down
2 changes: 1 addition & 1 deletion getdeck/fetch/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def fetch_data(

# info
display_location = location
if display_location == ".":
if display_location in [".", "", None]:
display_location = detect_deckfile()

logger.info(f"Reading Deckfile: {display_location or '.'}")
Expand Down
1 change: 0 additions & 1 deletion getdeck/provider/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def get_config(self):

def start_or_create(self) -> bool:
if self.exists():
logger.info("Cluster already exists, starting it")
self.start()
created = False
else:
Expand Down
1 change: 0 additions & 1 deletion getdeck/provider/beiboot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def stop(self) -> bool:
raise NotSupportedError(NOT_SUPPORTED_ERROR)

def delete(self) -> bool:
logger.info(f"Now deleting Beiboot '{self.cluster_name}'.")
api.remove_cluster(cluster_name=self.cluster_name, configuration=self._bbt_conf)
return True

Expand Down
4 changes: 0 additions & 4 deletions getdeck/provider/k3d/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
import sys
import subprocess
from typing import List, Dict, Optional
Expand All @@ -7,8 +6,6 @@
from getdeck.provider.types import ProviderType
from getdeck.provider.utility_provider import UtilityProvider

logger = logging.getLogger("deck")


class K3d(UtilityProvider):
kubernetes_cluster_type = ProviderType.K3D
Expand Down Expand Up @@ -76,7 +73,6 @@ def stop(self):
return True

def delete(self):
logger.info(f"Deleting the k3d cluster with name {self.cluster_name}")
arguments = ["cluster", "delete", self.cluster_name]
self._execute(arguments)
return True
Expand Down
4 changes: 0 additions & 4 deletions getdeck/provider/kind/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
import sys
import subprocess
from typing import List, Dict, Optional
Expand All @@ -8,8 +7,6 @@
from getdeck.provider.utility_provider import UtilityProvider
import platform

logger = logging.getLogger("deck")


class Kind(UtilityProvider):
kubernetes_cluster_type = ProviderType.KIND
Expand Down Expand Up @@ -90,7 +87,6 @@ def stop(self):
return True

def delete(self):
logger.info(f"Deleting the kind cluster with name {self.cluster_name}")
arguments = ["delete", "cluster", "--name", self.cluster_name]
self._execute(arguments)
return True
Expand Down
4 changes: 0 additions & 4 deletions getdeck/provider/kubectl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
from typing import List, Optional

from semantic_version import Version
Expand All @@ -8,9 +7,6 @@
from getdeck.provider.types import ProviderType


logger = logging.getLogger("deck")


class KubectlCtx(AbstractProvider):
kubernetes_cluster_type = ProviderType.KUBECTLCTX
provider_type = "kubectlctx"
Expand Down