Skip to content

Commit e589dfa

Browse files
Merge pull request openshift#488 from asalkeld/add-region-to-env
Allow the region to be passed in
2 parents 7edb0f2 + a8ca638 commit e589dfa

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export AZURE_TENANT_ID=
44
export AZURE_CLIENT_ID=
55
export AZURE_CLIENT_SECRET=
66

7+
# set the region to one of (eastus, westeurope or australiasoutheast)
8+
export AZURE_REGION=eastus
9+
710
# Set the DNS domain and resource group (mandatory)
811
export DNS_DOMAIN=osadev.cloud
912
export DNS_RESOURCEGROUP=dns

hack/create.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@ if [[ -z "$AZURE_CLIENT_SECRET" ]]; then
2525
exit 1
2626
fi
2727

28+
if [[ -z "$AZURE_REGION" ]]; then
29+
echo error: must set AZURE_REGION
30+
exit 1
31+
fi
32+
valid_regions=(eastus westeurope australiasoutheast)
33+
match=0
34+
for region in "${valid_regions[@]}"; do
35+
if [[ $region = "$valid_regions" ]]; then
36+
match=1
37+
break
38+
fi
39+
done
40+
if [[ $match = 0 ]]; then
41+
echo "Error invalid region: must be one of ${valid_regions[@]}"
42+
exit 1
43+
fi
44+
2845
if [[ -z "$DNS_DOMAIN" ]]; then
2946
echo error: must set DNS_DOMAIN
3047
exit 1
@@ -50,12 +67,12 @@ ttl=76h
5067
if [[ -n $RESOURCEGROUP_TTL ]]; then
5168
ttl=$RESOURCEGROUP_TTL
5269
fi
53-
az group create -n $RESOURCEGROUP -l eastus --tags now=$(date +%s) ttl=$ttl >/dev/null
70+
az group create -n $RESOURCEGROUP -l $AZURE_REGION --tags now=$(date +%s) ttl=$ttl >/dev/null
5471

5572
# if AZURE_CLIENT_ID is used as AZURE_AAD_CLIENT_ID, script will reset global team account!
5673
set +x
5774
if [[ "$AZURE_AAD_CLIENT_ID" && "$AZURE_AAD_CLIENT_ID" != "$AZURE_CLIENT_ID" ]]; then
58-
. <(hack/aad.sh app-update $AZURE_AAD_CLIENT_ID https://$RESOURCEGROUP.eastus.cloudapp.azure.com/oauth2callback/Azure%20AD)
75+
. <(hack/aad.sh app-update $AZURE_AAD_CLIENT_ID https://$RESOURCEGROUP.$AZURE_REGION.cloudapp.azure.com/oauth2callback/Azure%20AD)
5976
else
6077
AZURE_AAD_CLIENT_ID=$AZURE_CLIENT_ID
6178
AZURE_AAD_CLIENT_SECRET=$AZURE_CLIENT_SECRET
@@ -64,10 +81,10 @@ set -x
6481

6582
cat >_data/manifest.yaml <<EOF
6683
name: openshift
67-
location: eastus
84+
location: $AZURE_REGION
6885
properties:
6986
openShiftVersion: "$DEPLOY_VERSION"
70-
fqdn: $RESOURCEGROUP.eastus.cloudapp.azure.com
87+
fqdn: $RESOURCEGROUP.$AZURE_REGION.cloudapp.azure.com
7188
authProfile:
7289
identityProviders:
7390
- name: Azure AD
@@ -99,4 +116,4 @@ go run cmd/createorupdate/createorupdate.go -loglevel=debug
99116

100117
# TODO: This should be configured by MS
101118
hack/dns.sh zone-create $RESOURCEGROUP
102-
hack/dns.sh cname-create $RESOURCEGROUP '*' $RESOURCEGROUP-router.eastus.cloudapp.azure.com
119+
hack/dns.sh cname-create $RESOURCEGROUP '*' $RESOURCEGROUP-router.$AZURE_REGION.cloudapp.azure.com

0 commit comments

Comments
 (0)