node names logging

main
Malar Invention 2024-11-08 01:48:49 +05:30
parent 573f16c5c2
commit 3e89eaaa26
1 changed files with 3 additions and 8 deletions

View File

@ -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: