Skip to content

Commit fb48ea3

Browse files
committed
fix(dask): respect runtime namespace when deleting Dask clusters (#675)
Several Dask cluster deletion functions used hard-coded "default" namespace instead of respecting the runtime namespace as the Dask cluster creation functions were doing. This commit fixes the mismatch that would otherwise cause cleanup procedures to silently target the wrong namespace in non-default deployments.
1 parent 9044623 commit fb48ea3

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

reana_workflow_controller/dask.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ def delete_dask_cluster(workflow_id, user_id) -> None:
632632
group="kubernetes.dask.org",
633633
version="v1",
634634
plural="daskclusters",
635-
namespace="default",
635+
namespace=REANA_RUNTIME_KUBERNETES_NAMESPACE,
636636
name=get_dask_component_name(workflow_id, "cluster"),
637637
)
638638
logging.info(f"Dask cluster for workflow {workflow_id} deleted successfully.")
@@ -645,7 +645,7 @@ def delete_dask_cluster(workflow_id, user_id) -> None:
645645
group="kubernetes.dask.org",
646646
version="v1",
647647
plural="daskautoscalers",
648-
namespace="default",
648+
namespace=REANA_RUNTIME_KUBERNETES_NAMESPACE,
649649
name=get_dask_component_name(workflow_id, "autoscaler"),
650650
)
651651
logging.info(
@@ -765,13 +765,13 @@ def create_dask_dashboard_ingress(workflow_id, user_id):
765765
current_k8s_custom_objects_api_client.create_namespaced_custom_object(
766766
group="traefik.io",
767767
version="v1alpha1",
768-
namespace="default",
768+
namespace=REANA_RUNTIME_KUBERNETES_NAMESPACE,
769769
plural="middlewares",
770770
body=middleware_spec,
771771
)
772772
# Create the ingress resource
773773
current_k8s_networking_api_client.create_namespaced_ingress(
774-
namespace="default", body=ingress
774+
namespace=REANA_RUNTIME_KUBERNETES_NAMESPACE, body=ingress
775775
)
776776

777777

@@ -781,7 +781,7 @@ def delete_dask_dashboard_ingress(workflow_id):
781781
try:
782782
current_k8s_networking_api_client.delete_namespaced_ingress(
783783
get_dask_component_name(workflow_id, "dashboard_ingress"),
784-
namespace="default",
784+
namespace=REANA_RUNTIME_KUBERNETES_NAMESPACE,
785785
body=client.V1DeleteOptions(),
786786
)
787787
except Exception as e:
@@ -793,7 +793,7 @@ def delete_dask_dashboard_ingress(workflow_id):
793793
current_k8s_custom_objects_api_client.delete_namespaced_custom_object(
794794
group="traefik.io",
795795
version="v1alpha1",
796-
namespace="default",
796+
namespace=REANA_RUNTIME_KUBERNETES_NAMESPACE,
797797
plural="middlewares",
798798
name=get_dask_component_name(workflow_id, "dashboard_ingress_middleware"),
799799
)

0 commit comments

Comments
 (0)