Skip to content

Commit

Permalink
feat: Add support for multiple service dns prefix (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarojasm95 authored Nov 5, 2024
1 parent af40580 commit 3a39a0e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions aladdin/lib/k8s/ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ def _create_ingress_service_tuples(services, dual_dns_prefix_annotation_name):
name_port = "%s:%s" % (service.metadata.name, port)
# create service tuple from default service name
service_tuples_dict[name_port] = (service.metadata.name, port, service)
if dual_dns_prefix_annotation_name:
try:
# create service tuple from annotation dns
annotation_name = service.metadata.annotations[
dual_dns_prefix_annotation_name
]
except (AttributeError, KeyError, TypeError):
pass # no annotation found
else:
name_port = "%s:%s" % (annotation_name, port)
service_tuples_dict[name_port] = (annotation_name, port, service)
annotation_names = []
try:
# create service tuple from annotation dns
annotation_names = service.metadata.annotations[
dual_dns_prefix_annotation_name
].split(",")
except (AttributeError, KeyError, TypeError):
pass # no annotation found
for annotation_name in annotation_names:
name_port = "%s:%s" % (annotation_name, port)
service_tuples_dict[name_port] = (annotation_name, port, service)

return list(service_tuples_dict.values())

Expand Down

0 comments on commit 3a39a0e

Please sign in to comment.