Skip to content

Commit d9b5785

Browse files
committed
Check cluster-name tag when choosing load balancer for VPC Link integration (#1173)
(cherry picked from commit 8ad7f72)
1 parent 8a9917a commit d9b5785

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

manager/create_gateway_integration.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,24 @@ def get_istio_api_gateway_elb_arn(client_elb):
2525
elb_tags = client_elb.describe_tags(ResourceArns=[elb_arn])["TagDescriptions"][0][
2626
"Tags"
2727
]
28+
29+
is_from_cluster = False
30+
is_api_load_balancer = False
2831
for tag in elb_tags:
32+
if (
33+
tag["Key"] == "cortex.dev/cluster-name"
34+
and tag["Value"] == os.environ["CORTEX_CLUSTER_NAME"]
35+
):
36+
is_from_cluster = True
2937
if (
3038
tag["Key"] == "kubernetes.io/service-name"
3139
and tag["Value"] == "istio-system/ingressgateway-apis"
3240
):
33-
return elb_arn
41+
is_api_load_balancer = True
42+
43+
if is_from_cluster and is_api_load_balancer:
44+
return elb_arn
45+
3446
raise Exception("Could not find ingressgateway-apis ELB")
3547

3648

0 commit comments

Comments
 (0)