Skip to content

Commit

Permalink
fix: handle missing namespace in K8sContext by defaulting to 'default'
Browse files Browse the repository at this point in the history
  • Loading branch information
vstirbu committed Jan 15, 2025
1 parent 316fa44 commit a034dfd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion q8s/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def __init__(self, kubeconfig: str, logger=None):

_, active_context = config.list_kube_config_contexts(config_file=kubeconfig)

self.namespace = active_context["context"]["namespace"]
try:
self.namespace = active_context["context"]["namespace"]
except KeyError:
self.namespace = "default"
logging.info("Active namespace: %s" % self.namespace)

self.core_api_instance = client.CoreV1Api()
Expand Down

0 comments on commit a034dfd

Please sign in to comment.