node names logging
parent
573f16c5c2
commit
3e89eaaa26
|
|
@ -44,7 +44,7 @@ async def watch_nodes():
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
# Check for external IP
|
# Check for external IP
|
||||||
external_ips = []
|
external_ips, node_names = [], []
|
||||||
async for event in w.stream(
|
async for event in w.stream(
|
||||||
v1.list_node,
|
v1.list_node,
|
||||||
label_selector=NODE_LABEL,
|
label_selector=NODE_LABEL,
|
||||||
|
|
@ -56,18 +56,13 @@ async def watch_nodes():
|
||||||
for address in node.status.addresses:
|
for address in node.status.addresses:
|
||||||
if address.type == "ExternalIP":
|
if address.type == "ExternalIP":
|
||||||
external_ips.append(address.address)
|
external_ips.append(address.address)
|
||||||
|
node_names.append(node_name)
|
||||||
if len(external_ips) > 0:
|
if len(external_ips) > 0:
|
||||||
print(
|
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,
|
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)
|
service = await v1.read_namespaced_service(SERVICE_NAME, NAMESPACE)
|
||||||
# for service in services.items:
|
|
||||||
await update_service_annotation(v1, service.metadata.name, external_ips)
|
await update_service_annotation(v1, service.metadata.name, external_ips)
|
||||||
|
|
||||||
except client.exceptions.ApiException as e:
|
except client.exceptions.ApiException as e:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue