From dec5ea7173d7fb273ed8a7be1effb9a87094afc4 Mon Sep 17 00:00:00 2001 From: Rob Leidle Date: Wed, 20 Jun 2018 16:00:30 -0700 Subject: [PATCH] The cluster name in generate-yaml.sh is now a random string. This change removes the static name from generate-yaml.sh and instead generates a random string for the name. The reason for doing this is to allow the script to be run over and over without failing due to accounts already existing with the same name and to allow developers to verify their changes with a more clean environment --- clusterctl/examples/google/generate-yaml.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clusterctl/examples/google/generate-yaml.sh b/clusterctl/examples/google/generate-yaml.sh index 5ea7cafa0318..bb487ac9e881 100755 --- a/clusterctl/examples/google/generate-yaml.sh +++ b/clusterctl/examples/google/generate-yaml.sh @@ -21,7 +21,9 @@ set -o pipefail GCLOUD_PROJECT=$(gcloud config get-value project) ZONE=$(gcloud config get-value compute/zone) ZONE="${ZONE:-us-central1-f}" -CLUSTER_NAME=test1 +# Generate a somewhat unique cluster name, UUID is not an option as service-accounts are limited to 30 characters in length +# and have a 19 character prefix (i.e. 'machine-controller-') +CLUSTER_NAME=$(head -c11 < <(LC_ALL=C tr -dc 'a-zA-Z0-9' < /dev/urandom) | tr '[:upper:]' '[:lower:]') OUTPUT_DIR=out @@ -184,3 +186,5 @@ cat $ADDON_TEMPLATE_FILE \ | sed -e "s/\$CLUSTER_NAME/$CLUSTER_NAME/" \ | sed "s/\$LOADBALANCER_SA_KEY/$LOADBALANCER_SA_KEY/" \ > $ADDON_GENERATED_FILE + +echo -e "\nYour generated cluster name is '${CLUSTER_NAME}'" \ No newline at end of file