diff --git a/src/_nebari/upgrade.py b/src/_nebari/upgrade.py index f464ad9dec..f264479e3e 100644 --- a/src/_nebari/upgrade.py +++ b/src/_nebari/upgrade.py @@ -661,6 +661,8 @@ def _version_specific_upgrade( argo_sa = ["argo-admin", "argo-dev", "argo-view"] + namespace = config.get("namespace", "default") + if kwargs.get("attempt_fixes", False): try: kubernetes.config.load_kube_config() @@ -682,7 +684,6 @@ def _version_specific_upgrade( else: raise e - namespace = config.get("namespace", "default") for sa in argo_sa: api_instance = kubernetes.client.CoreV1Api() try: @@ -708,7 +709,7 @@ def _version_specific_upgrade( ( *( "kubectl delete sa", - f"-n {config.get('namespace', 'default')}", + f"-n {namespace}", ), *argo_sa, ),