diff --git a/node_external_ip_controller_async.py b/node_external_ip_controller_async.py index 7d4f80c..28eff35 100644 --- a/node_external_ip_controller_async.py +++ b/node_external_ip_controller_async.py @@ -44,7 +44,7 @@ async def watch_nodes(): while True: try: # Check for external IP - external_ips = [] + external_ips, node_names = [], [] async for event in w.stream( v1.list_node, label_selector=NODE_LABEL, @@ -56,18 +56,13 @@ async def watch_nodes(): for address in node.status.addresses: if address.type == "ExternalIP": external_ips.append(address.address) + node_names.append(node_name) if len(external_ips) > 0: print( - f"Detected external IP {str(external_ips)} for node {node_name}", + f"Detected external IPs {str(external_ips)} for node {str(node_names)}", flush=True, ) - - # Get all services that need to be updated with this external IP - # services = await v1.list_namespaced_service( - # NAMESPACE, label_selector=SERVICE_NAME_PATTERN - # ) service = await v1.read_namespaced_service(SERVICE_NAME, NAMESPACE) - # for service in services.items: await update_service_annotation(v1, service.metadata.name, external_ips) except client.exceptions.ApiException as e: