From 2b5d2d84dd5af363e1db4765828b4d61b76367b8 Mon Sep 17 00:00:00 2001 From: catzc Date: Tue, 17 Sep 2024 16:16:38 +0000 Subject: [PATCH] Fix loadBalancer attribute name Closes #906 --- dask_kubernetes/operator/controller/controller.py | 2 +- dask_kubernetes/operator/networking.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dask_kubernetes/operator/controller/controller.py b/dask_kubernetes/operator/controller/controller.py index c34aa0ce7..ce1f5a0a3 100644 --- a/dask_kubernetes/operator/controller/controller.py +++ b/dask_kubernetes/operator/controller/controller.py @@ -401,7 +401,7 @@ async def handle_scheduler_service_status( assert namespace # If the Service is a LoadBalancer with no ingress endpoints mark the cluster as Pending if spec["type"] == "LoadBalancer" and not len( - status.get("load_balancer", {}).get("ingress", []) + status.get("loadBalancer", {}).get("ingress", []) ): phase = "Pending" # Otherwise mark it as Running diff --git a/dask_kubernetes/operator/networking.py b/dask_kubernetes/operator/networking.py index 1e9916406..2978889bf 100644 --- a/dask_kubernetes/operator/networking.py +++ b/dask_kubernetes/operator/networking.py @@ -50,8 +50,8 @@ async def get_external_address_for_scheduler_service( """Take a service object and return the scheduler address.""" if service.spec.type == "LoadBalancer": port = _get_port(service, port_name) - lb = service.status.load_balancer.ingress[0] - host = lb.hostname or lb.ip + lb = service.status.loadBalancer.ingress[0] + host = lb.get("hostname", None) or lb.ip elif service.spec.type == "NodePort": port = _get_port(service, port_name, is_node_port=True) nodes = await kr8s.asyncio.get("nodes")