Skip to content

Commit

Permalink
NE-1324: Make caller-reference unique for AWS PHZ creation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gcs278 committed Sep 20, 2023
1 parent ef175df commit 42ad710
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 42ad710

Please sign in to comment.