From 4d08a9d5abe824ce9b4fcda0e1b1d53512bb8059 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 18 Sep 2019 12:24:49 -0700 Subject: [PATCH] ci-operator/templates/openshift/installer/cluster-launch-installer-*: 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 78ade84ab4 (Prow: drop max azure CI clusters to 5, 2019-09-18, #5074) and 594930f15 (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 ca464ed884 (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 ca464ed884 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 --- .../installer/cluster-launch-installer-e2e.yaml | 12 +++++++++--- .../installer/cluster-launch-installer-src.yaml | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ci-operator/templates/openshift/installer/cluster-launch-installer-e2e.yaml b/ci-operator/templates/openshift/installer/cluster-launch-installer-e2e.yaml index cfd8b584cfcc..0b6e3f53acc1 100644 --- a/ci-operator/templates/openshift/installer/cluster-launch-installer-e2e.yaml +++ b/ci-operator/templates/openshift/installer/cluster-launch-installer-e2e.yaml @@ -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 @@ -685,7 +683,7 @@ objects: - name: INSTALL_INITIAL_RELEASE - name: RELEASE_IMAGE_INITIAL command: - - /bin/sh + - /bin/bash - -c - | #!/bin/sh @@ -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} diff --git a/ci-operator/templates/openshift/installer/cluster-launch-installer-src.yaml b/ci-operator/templates/openshift/installer/cluster-launch-installer-src.yaml index 25ed04403b1f..ccbf72de27c1 100644 --- a/ci-operator/templates/openshift/installer/cluster-launch-installer-src.yaml +++ b/ci-operator/templates/openshift/installer/cluster-launch-installer-src.yaml @@ -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 @@ -304,7 +302,7 @@ objects: - name: HOME value: /tmp command: - - /bin/sh + - /bin/bash - -c - | #!/bin/sh @@ -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}