From 48ed3cbe957107f163608132145c5eb2b38fe473 Mon Sep 17 00:00:00 2001 From: vitali-federau-fivestars Date: Wed, 22 Nov 2023 15:22:21 +0300 Subject: [PATCH] [INFRA-2155] Removing function to create HZ --- aladdin/lib/aws/dns_mapping.py | 29 +++++++---------------------- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/aladdin/lib/aws/dns_mapping.py b/aladdin/lib/aws/dns_mapping.py index cac775a..94e9bb6 100644 --- a/aladdin/lib/aws/dns_mapping.py +++ b/aladdin/lib/aws/dns_mapping.py @@ -10,13 +10,16 @@ def fill_hostedzone( ): cluster_domain_name = cluster_domain_name or ClusterRules().cluster_domain_name namespace_domain_name = namespace_domain_name or ClusterRules().namespace_domain_name - namespace_hosted_zone = get_hostedzone( - boto_session, namespace_domain_name - ) or create_hostedzone(boto_session, namespace_domain_name) + # Get the namespace hosted zone, raise an error if not found + namespace_hosted_zone = get_hostedzone(boto_session, namespace_domain_name) + if namespace_hosted_zone is None: + raise KeyError("Hosted zone for [%s] not found" % namespace_domain_name) + + # Get the cluster hosted zone, raise an error if not found cluster_hosted_zone = get_hostedzone(boto_session, cluster_domain_name) if cluster_hosted_zone is None: - raise KeyError("route 53 for [%s] not found" % cluster_domain_name) + raise KeyError("Route 53 for [%s] not found" % cluster_domain_name) dns_nameservers = get_ns_from_hostedzone(boto_session, namespace_hosted_zone) @@ -48,24 +51,6 @@ def get_hostedzone(boto_session, dns_name) -> str: return hostedzone_id -def create_hostedzone(boto_session, dns_name) -> str: - log = logging.getLogger(__name__) - route53 = boto_session.client("route53") - - ref = "aladdin_generated_{:%Y%m%d_%H%M%S}".format(datetime.now()) - - log.info("Hosted zone %s created", dns_name) - - log.info("Creating hosted zone : %s", dns_name) - create_res = route53.create_hosted_zone( - Name=dns_name, - CallerReference=ref, - HostedZoneConfig=dict(Comment="Generated by aladdin", PrivateZone=False), - ) - - return create_res["HostedZone"]["Id"] - - def get_ns_from_hostedzone(boto_session, hostedzone_id): route53 = boto_session.client("route53") diff --git a/pyproject.toml b/pyproject.toml index c90f1eb..4207938 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aladdin" -version = "1.25.15.2" +version = "1.25.15.3" description = "" authors = ["Fivestars "] include = [