Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The cluster name in generate-yaml.sh is now a random string. #370

Merged
merged 1 commit into from
Jun 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion clusterctl/examples/google/generate-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ 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 one has a 19 character prefix (i.e. 'machine-controller-'). Of the 11 remaining characters 6 are reserved for the human
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since names must be so short we should consider making the fixed part of this one much shorter (e.g. mc-) at some point. For now I think making the human part be super short is ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll follow up with that change. I agree that 'mc' is fine... for us, but for new hires it will be difficult. Maybe that's just what we have to live with for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also "cc" for cluster-controller will be a bit cryptic.

# friendly cluster name, one for a dash, and 5 are left for this random string.
RANDOM_STRING=$(head -c5 < <(LC_ALL=C tr -dc 'a-zA-Z0-9' < /dev/urandom) | tr '[:upper:]' '[:lower:]')
# Human friendly cluster name, limited to 6 characters
HUMAN_FRIENDLY_CLUSTER_NAME=test1
CLUSTER_NAME=${HUMAN_FRIENDLY_CLUSTER_NAME}-${RANDOM_STRING}

OUTPUT_DIR=out

Expand Down Expand Up @@ -184,3 +190,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 cluster name is '${CLUSTER_NAME}'"