fix: if no ip exists set empty set

main
Malar Invention 2025-01-12 19:40:00 +05:30
parent 15ad2e5902
commit 799071601e
1 changed files with 4 additions and 2 deletions

View File

@ -34,8 +34,10 @@ async def update_service_annotation(v1, service, external_ipset):
logger.debug(f"Fetching service {service_name} in namespace {namespace}")
service_obj = await v1.read_namespaced_service(service_name, namespace)
current_annotation = service_obj.metadata.annotations.get(ANNOTATION_KEY)
annotated_ips = set(current_annotation.split(","))
current_annotation = service_obj.metadata.annotations.get(ANNOTATION_KEY, "")
annotated_ips = (
set(current_annotation.split(",")) if current_annotation else set()
)
zlan_gateway_ip = service_obj.metadata.labels.get(ZLAN_GATEWAY_IP_KEY)
logger.debug(f"Zlan Gateway IP: {zlan_gateway_ip}")