From 97c030085afe3dbbbdee924b3e20c527d0bc141f Mon Sep 17 00:00:00 2001 From: Grant Spence Date: Wed, 20 Sep 2023 12:14:14 -0800 Subject: [PATCH] NE-1324: Make caller-reference unique for AWS PHZ creation (#43517) The caller-reference when creating a private hosted zone needs to be unique. In some pre-submit job run situations, it reuses the cluster name, causing caller-reference to reused. This solution simply adds a timestamp to caller reference to always ensure it's unique. --- .../aws-provision-route53-private-hosted-zone-commands.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci-operator/step-registry/aws/provision/route53/private-hosted-zone/aws-provision-route53-private-hosted-zone-commands.sh b/ci-operator/step-registry/aws/provision/route53/private-hosted-zone/aws-provision-route53-private-hosted-zone-commands.sh index 9b4c8a49a055..ef82931f3c6d 100755 --- a/ci-operator/step-registry/aws/provision/route53/private-hosted-zone/aws-provision-route53-private-hosted-zone-commands.sh +++ b/ci-operator/step-registry/aws/provision/route53/private-hosted-zone/aws-provision-route53-private-hosted-zone-commands.sh @@ -18,7 +18,10 @@ CLUSTER_NAME="${NAMESPACE}-${UNIQUE_HASH}" ROUTE53_HOSTED_ZONE_NAME="${CLUSTER_NAME}.${BASE_DOMAIN}" VPC_ID=$(cat "${SHARED_DIR}/vpc_id") -CALLER_REFERENCE_STR=$ROUTE53_HOSTED_ZONE_NAME +# Use a timestamp to ensure the caller reference is unique, as we've found +# cluster name can get reused in specific situations. +TIMESTAMP=$(date +%s) +CALLER_REFERENCE_STR="${ROUTE53_HOSTED_ZONE_NAME}-${TIMESTAMP}" echo -e "creating route53 hosted zone: ${ROUTE53_HOSTED_ZONE_NAME}" HOSTED_ZONE_CREATION=$(aws --region "$REGION" route53 create-hosted-zone --name "${ROUTE53_HOSTED_ZONE_NAME}" --vpc VPCRegion="${REGION}",VPCId="${VPC_ID}" --caller-reference "${CALLER_REFERENCE_STR}")