fix: if no ip exists set empty set
This commit is contained in:
@@ -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}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user