Skip to content

Commit

Permalink
ci-operator/templates/openshift/installer/cluster-launch-installer-*:…
Browse files Browse the repository at this point in the history
… Random Azure regions

Shard over four regions to increase our capacity, because Azure allows
auto-bumps for vCPU limits up to 200 in each region, but it's a longer
process to get the limits raised beyond that in a single region.  This
sets us up for more lease-restriction relaxing after 78ade84 (Prow:
drop max azure CI clusters to 5, 2019-09-18, #5074) and 594930f
(Prow: increase max Azure CI clusters to 20, 2019-09-18, #5084).  We
may want per-region quotas, but for the moment I'm just hoping that
our random choices are even enough that an Azure-wide quota is
sufficient.  And conveniently, $RANDOM runs from 0 through 32767 [1],
so our modulo 4 value is evenly weighted :).

The change to Bash is because Bash supports $RANDOM [1], but POSIX
does not [2].  We already use RANDOM in
openshift-installer-master-presubmits.yaml since ca464ed
(openshift/installer: add IaaS-agnostic E2E test, 2019-06-20, #4148).

Ideally we'd be loading the set of region choices (and possibly
weights) from some shared location somewhat like ca464ed has
things.  And we'd be reporting the chosen region in a structured way
for convenient monitoring.  But the plan is to break up these
templates into more composable chunks soon anyway, so I'm ok if we
aren't all that DRY in the short term.

[1]: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-RANDOM
[2]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_05_03
  • Loading branch information
wking committed Sep 18, 2019
1 parent 269843f commit 4d08a9d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,6 @@ objects:
value: us-east-1
- name: AZURE_AUTH_LOCATION
value: /etc/openshift-installer/osServicePrincipal.json
- name: AZURE_REGION
value: centralus
- name: GCP_REGION
value: us-east1
- name: GCP_PROJECT
Expand Down Expand Up @@ -685,7 +683,7 @@ objects:
- name: INSTALL_INITIAL_RELEASE
- name: RELEASE_IMAGE_INITIAL
command:
- /bin/sh
- /bin/bash
- -c
- |
#!/bin/sh
Expand Down Expand Up @@ -759,6 +757,14 @@ objects:
${SSH_PUB_KEY}
EOF
elif [[ "${CLUSTER_TYPE}" == "azure4" ]]; then
case $((RANDOM % 4)) in
0) AZURE_REGION=centralus;;
1) AZURE_REGION=eastus;;
2) AZURE_REGION=eastus2;;
3) AZURE_REGION=westus;;
*) echo >&2 "invalid Azure region index"; exit 1;;
esac
cat > /tmp/artifacts/installer/install-config.yaml << EOF
apiVersion: v1
baseDomain: ${BASE_DOMAIN:-ci.azure.devcluster.openshift.com}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ objects:
value: us-east-1
- name: AZURE_AUTH_LOCATION
value: /etc/openshift-installer/osServicePrincipal.json
- name: AZURE_REGION
value: centralus
- name: GCP_REGION
value: us-east1
- name: GCP_PROJECT
Expand Down Expand Up @@ -304,7 +302,7 @@ objects:
- name: HOME
value: /tmp
command:
- /bin/sh
- /bin/bash
- -c
- |
#!/bin/sh
Expand Down Expand Up @@ -369,6 +367,14 @@ objects:
${SSH_PUB_KEY}
EOF
elif [[ "${CLUSTER_TYPE}" == "azure4" ]]; then
case $((RANDOM % 4)) in
0) AZURE_REGION=centralus;;
1) AZURE_REGION=eastus;;
2) AZURE_REGION=eastus2;;
3) AZURE_REGION=westus;;
*) echo >&2 "invalid Azure region index"; exit 1;;
esac
cat > /tmp/artifacts/installer/install-config.yaml << EOF
apiVersion: v1
baseDomain: ${BASE_DOMAIN:-ci.azure.devcluster.openshift.com}
Expand Down

0 comments on commit 4d08a9d

Please sign in to comment.