Skip to content

Commit

Permalink
The cluster name in generate-yaml.sh is now a random string.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
spew committed Jun 22, 2018
1 parent cbc610d commit dec5ea7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion clusterctl/examples/google/generate-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}'"

0 comments on commit dec5ea7

Please sign in to comment.