Skip to content

Commit

Permalink
Improve generate-yaml.sh (#50)
Browse files Browse the repository at this point in the history
* Let LOCATION became configurable in generate-yaml.sh

Signed-off-by: solidnerd <[email protected]>

* Create Output dir before SP will be generated

This will fix a problem when you try to generate a sp from scratch. Because $CREDENTIALS_FILE also use the outputdir otherwise you would get an error for creating a sp.

Signed-off-by: solidnerd <[email protected]>
  • Loading branch information
solidnerd authored and k8s-ci-robot committed Jan 14, 2019
1 parent 01eb190 commit 51be9a3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cmd/clusterctl/examples/azure/generate-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RANDOM_STRING=$(head -c5 < <(LC_ALL=C tr -dc 'a-zA-Z0-9' < /dev/urandom) | tr '[
HUMAN_FRIENDLY_CLUSTER_NAME="${HUMAN_FRIENDLY_CLUSTER_NAME:-test1}"
CLUSTER_NAME=${HUMAN_FRIENDLY_CLUSTER_NAME}-${RANDOM_STRING}
RESOURCE_GROUP="${RESOURCE_GROUP:-clusterapi}"-${RANDOM_STRING}
LOCATION=${LOCATION:-"westus2"}

OUTPUT_DIR=${OUTPUT_DIR:-out}
SSH_KEY_FILE=${OUTPUT_DIR}/sshkey
Expand Down Expand Up @@ -55,6 +56,8 @@ while test $# -gt 0; do
esac
done

mkdir -p ${OUTPUT_DIR}

if [ $OVERWRITE -ne 1 ] && [ -f $MACHINE_GENERATED_FILE ]; then
echo File $MACHINE_GENERATED_FILE already exists. Delete it manually before running this script.
exit 1
Expand Down Expand Up @@ -96,10 +99,6 @@ else
printf "AZURE_TENANT_ID=%s\n" "$TENANT_ID" >> "$CREDENTIALS_FILE"
fi

LOCATION="westus2"

mkdir -p ${OUTPUT_DIR}

rm -f $SSH_KEY_FILE 2>/dev/null
ssh-keygen -t rsa -b 2048 -f $SSH_KEY_FILE -N '' 1>/dev/null

Expand Down

0 comments on commit 51be9a3

Please sign in to comment.