From a02728cbc9015ef4671ca17b1c208870cf5b0b31 Mon Sep 17 00:00:00 2001 From: Roi Vazquez Date: Mon, 4 May 2026 15:53:09 +0200 Subject: [PATCH] Use slot-manager for e2e jobs --- .../Azure/ARO-HCP/Azure-ARO-HCP-main.yaml | 6 +- .../step-registry/aro-hcp/lease/OWNERS | 8 +++ .../aro-hcp/lease/acquire/OWNERS | 8 +++ .../acquire/aro-hcp-lease-acquire-commands.sh | 29 +++++++++ .../aro-hcp-lease-acquire-ref.metadata.json | 15 +++++ .../acquire/aro-hcp-lease-acquire-ref.yaml | 62 +++++++++++++++++++ .../aro-hcp/lease/release/OWNERS | 8 +++ .../release/aro-hcp-lease-release-commands.sh | 6 ++ .../aro-hcp-lease-release-ref.metadata.json | 15 +++++ .../release/aro-hcp-lease-release-ref.yaml | 10 +++ .../local-e2e/aro-hcp-local-e2e-workflow.yaml | 9 +-- .../aro-hcp-provision-environment-commands.sh | 12 ++++ .../aro-hcp-provision-environment-ref.yaml | 3 + .../test/local/aro-hcp-test-local-commands.sh | 13 +++- .../aro-hcp-write-config-commands.sh | 14 ++++- .../aro-hcp-write-config-ref.yaml | 4 +- 16 files changed, 207 insertions(+), 15 deletions(-) create mode 100644 ci-operator/step-registry/aro-hcp/lease/OWNERS create mode 100644 ci-operator/step-registry/aro-hcp/lease/acquire/OWNERS create mode 100644 ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-commands.sh create mode 100644 ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-ref.metadata.json create mode 100644 ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-ref.yaml create mode 100644 ci-operator/step-registry/aro-hcp/lease/release/OWNERS create mode 100644 ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-commands.sh create mode 100644 ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-ref.metadata.json create mode 100644 ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-ref.yaml diff --git a/ci-operator/config/Azure/ARO-HCP/Azure-ARO-HCP-main.yaml b/ci-operator/config/Azure/ARO-HCP/Azure-ARO-HCP-main.yaml index d6a33d901b8cb..3fc0e5681d606 100644 --- a/ci-operator/config/Azure/ARO-HCP/Azure-ARO-HCP-main.yaml +++ b/ci-operator/config/Azure/ARO-HCP/Azure-ARO-HCP-main.yaml @@ -496,11 +496,7 @@ tests: env: ARO_HCP_CLOUD: dev ARO_HCP_DEPLOY_ENV: ci01 - LOCATION: westus3 - leases: - - count: 1 - env: ENV_QUOTA_LEASED_RESOURCE - resource_type: aro-hcp-dev-quota-slice + MULTISTAGE_PARAM_OVERRIDE_LOCATION: westus3 workflow: aro-hcp-local-e2e timeout: 10h0m0s - as: global-pipeline-postsubmit diff --git a/ci-operator/step-registry/aro-hcp/lease/OWNERS b/ci-operator/step-registry/aro-hcp/lease/OWNERS new file mode 100644 index 0000000000000..8b5c8784266a3 --- /dev/null +++ b/ci-operator/step-registry/aro-hcp/lease/OWNERS @@ -0,0 +1,8 @@ +approvers: +- aro-hcp-sl-approvers +- geoberle +- deads2k +reviewers: +- aro-hcp-sl-reviewers +- geoberle +- deads2k diff --git a/ci-operator/step-registry/aro-hcp/lease/acquire/OWNERS b/ci-operator/step-registry/aro-hcp/lease/acquire/OWNERS new file mode 100644 index 0000000000000..8b5c8784266a3 --- /dev/null +++ b/ci-operator/step-registry/aro-hcp/lease/acquire/OWNERS @@ -0,0 +1,8 @@ +approvers: +- aro-hcp-sl-approvers +- geoberle +- deads2k +reviewers: +- aro-hcp-sl-reviewers +- geoberle +- deads2k diff --git a/ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-commands.sh b/ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-commands.sh new file mode 100644 index 0000000000000..d80257d1abfce --- /dev/null +++ b/ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-commands.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -o errexit +set -o nounset +set -o pipefail + +export CLUSTER_PROFILE_DIR="/var/run/aro-hcp-${VAULT_SECRET_PROFILE}" + +slot_manager_args=( + --deploy-env "${ARO_HCP_DEPLOY_ENV}" + --shared-dir "${SHARED_DIR}" +) + +if [[ -n "${ALLOWED_SUBSCRIPTIONS:-}" ]]; then + slot_manager_args+=(--allowed-subscriptions "${ALLOWED_SUBSCRIPTIONS}") +fi + +if [[ -n "${ALLOWED_LOCATIONS:-}" ]]; then + slot_manager_args+=(--allowed-locations "${ALLOWED_LOCATIONS}") +fi + +if [[ -n "${ARO_HCP_SLOT_MANAGER_MAX_WAIT_FOR_LEASE:-}" ]]; then + slot_manager_args+=(--max-wait-for-lease "${ARO_HCP_SLOT_MANAGER_MAX_WAIT_FOR_LEASE}") +fi + +if [[ -n "${ARO_HCP_SLOT_MANAGER_LEASE_WAIT_INTERVAL:-}" ]]; then + slot_manager_args+=(--lease-wait-interval "${ARO_HCP_SLOT_MANAGER_LEASE_WAIT_INTERVAL}") +fi + +./test/aro-hcp-tests slot-manager acquire "${slot_manager_args[@]}" diff --git a/ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-ref.metadata.json b/ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-ref.metadata.json new file mode 100644 index 0000000000000..8a5e8fc7ae7c4 --- /dev/null +++ b/ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-ref.metadata.json @@ -0,0 +1,15 @@ +{ + "path": "aro-hcp/lease/acquire/aro-hcp-lease-acquire-ref.yaml", + "owners": { + "approvers": [ + "aro-hcp-sl-approvers", + "geoberle", + "deads2k" + ], + "reviewers": [ + "aro-hcp-sl-reviewers", + "geoberle", + "deads2k" + ] + } +} \ No newline at end of file diff --git a/ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-ref.yaml b/ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-ref.yaml new file mode 100644 index 0000000000000..b309f0ada73a8 --- /dev/null +++ b/ci-operator/step-registry/aro-hcp/lease/acquire/aro-hcp-lease-acquire-ref.yaml @@ -0,0 +1,62 @@ +ref: + as: aro-hcp-lease-acquire + from: aro-hcp-e2e-tests + commands: aro-hcp-lease-acquire-commands.sh + grace_period: 15s + credentials: + - namespace: test-credentials + name: cluster-secrets-aro-hcp-dev + mount_path: /var/run/aro-hcp-dev + - namespace: test-credentials + name: cluster-secrets-aro-hcp-int + mount_path: /var/run/aro-hcp-int + - namespace: test-credentials + name: cluster-secrets-aro-hcp-stg + mount_path: /var/run/aro-hcp-stg + - namespace: test-credentials + name: cluster-secrets-aro-hcp-prod + mount_path: /var/run/aro-hcp-prod + resources: + requests: + cpu: 10m + memory: 100Mi + env: + - name: VAULT_SECRET_PROFILE + default: "dev" + documentation: |- + Selects which environment's cluster secrets to use (dev, int, stg, prod). + - name: ALLOWED_SUBSCRIPTIONS + default: "" + documentation: |- + Optional comma-separated allowlist of catalog `subscription_name` + values that `slot-manager acquire` may consider for candidate pool + selection. + - name: ALLOWED_LOCATIONS + default: "" + documentation: |- + Optional comma-separated allowlist of Azure regions for fixed-mode + candidate pool selection (for example, `centralus,canadacentral`). + - name: MULTISTAGE_PARAM_OVERRIDE_LOCATION + default: "" + documentation: |- + Highest-precedence concrete location override for the runtime slot. + When set, it takes precedence over `ALLOWED_LOCATIONS`. + - name: ARO_HCP_DEPLOY_ENV + default: "" + documentation: Config environment name (prow, ci01, int, stg, prod). + - name: ARO_HCP_SLOT_MANAGER_MAX_WAIT_FOR_LEASE + default: "" + documentation: |- + Optional override for `slot-manager acquire --max-wait-for-lease`. + Leave unset to use the binary default (currently 30m). Set to `0s` + to wait forever after a full exhausted pass across all candidate pools. + - name: ARO_HCP_SLOT_MANAGER_LEASE_WAIT_INTERVAL + default: "" + documentation: |- + Optional override for `slot-manager acquire --lease-wait-interval`. + Leave unset to use the binary default (currently 1m). This controls + the delay between retries after a full exhausted pass across all + candidate pools. + documentation: |- + Acquire the runtime Boskos leases required by ARO HCP E2E workflows and + persist the runtime slot env contract into SHARED_DIR for later steps. diff --git a/ci-operator/step-registry/aro-hcp/lease/release/OWNERS b/ci-operator/step-registry/aro-hcp/lease/release/OWNERS new file mode 100644 index 0000000000000..8b5c8784266a3 --- /dev/null +++ b/ci-operator/step-registry/aro-hcp/lease/release/OWNERS @@ -0,0 +1,8 @@ +approvers: +- aro-hcp-sl-approvers +- geoberle +- deads2k +reviewers: +- aro-hcp-sl-reviewers +- geoberle +- deads2k diff --git a/ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-commands.sh b/ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-commands.sh new file mode 100644 index 0000000000000..1e12037a99af5 --- /dev/null +++ b/ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-commands.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -o errexit +set -o nounset +set -o pipefail + +./test/aro-hcp-tests slot-manager release --shared-dir "${SHARED_DIR}" diff --git a/ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-ref.metadata.json b/ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-ref.metadata.json new file mode 100644 index 0000000000000..094ad7678c5c7 --- /dev/null +++ b/ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-ref.metadata.json @@ -0,0 +1,15 @@ +{ + "path": "aro-hcp/lease/release/aro-hcp-lease-release-ref.yaml", + "owners": { + "approvers": [ + "aro-hcp-sl-approvers", + "geoberle", + "deads2k" + ], + "reviewers": [ + "aro-hcp-sl-reviewers", + "geoberle", + "deads2k" + ] + } +} \ No newline at end of file diff --git a/ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-ref.yaml b/ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-ref.yaml new file mode 100644 index 0000000000000..011257acf45d4 --- /dev/null +++ b/ci-operator/step-registry/aro-hcp/lease/release/aro-hcp-lease-release-ref.yaml @@ -0,0 +1,10 @@ +ref: + as: aro-hcp-lease-release + from: aro-hcp-e2e-tests + commands: aro-hcp-lease-release-commands.sh + resources: + requests: + cpu: 10m + memory: 100Mi + documentation: |- + Release the runtime Boskos leases acquired for an ARO HCP E2E workflow. diff --git a/ci-operator/step-registry/aro-hcp/local-e2e/aro-hcp-local-e2e-workflow.yaml b/ci-operator/step-registry/aro-hcp/local-e2e/aro-hcp-local-e2e-workflow.yaml index 206c8f9c92c1b..b58b88df9709b 100644 --- a/ci-operator/step-registry/aro-hcp/local-e2e/aro-hcp-local-e2e-workflow.yaml +++ b/ci-operator/step-registry/aro-hcp/local-e2e/aro-hcp-local-e2e-workflow.yaml @@ -2,14 +2,8 @@ workflow: as: aro-hcp-local-e2e steps: allow_best_effort_post_steps: true - leases: - - resource_type: aro-hcp-test-msi-containers-dev - env: LEASED_MSI_CONTAINERS - count: 20 - - resource_type: aro-hcp-msi-mock-cs-sp-dev - env: LEASED_MSI_MOCK_SP - count: 1 pre: + - ref: aro-hcp-lease-acquire - ref: aro-hcp-write-config - ref: aro-hcp-provision-environment test: @@ -22,5 +16,6 @@ workflow: - ref: aro-hcp-gather-observability - ref: aro-hcp-gather-snapshot - ref: aro-hcp-deprovision-environment + - ref: aro-hcp-lease-release documentation: |- The local ARO HCP e2e workflow starts an ARO HCP environment and runs the full end-to-end suite against it. diff --git a/ci-operator/step-registry/aro-hcp/provision/environment/aro-hcp-provision-environment-commands.sh b/ci-operator/step-registry/aro-hcp/provision/environment/aro-hcp-provision-environment-commands.sh index f7ac83b64b84f..c1c78be2b4222 100644 --- a/ci-operator/step-registry/aro-hcp/provision/environment/aro-hcp-provision-environment-commands.sh +++ b/ci-operator/step-registry/aro-hcp/provision/environment/aro-hcp-provision-environment-commands.sh @@ -3,6 +3,18 @@ set -o errexit set -o nounset set -o pipefail +env_file="${SHARED_DIR}/aro-hcp-slot.env" +if [[ ! -f "${env_file}" ]]; then + printf 'Missing runtime lease export file: %s\n' "${env_file}" >&2 + exit 1 +fi + +# shellcheck disable=SC1090 +source "${env_file}" + +export LOCATION="${SELECTED_LOCATION:-${LOCATION:-}}" +: "${LOCATION:?LOCATION must be provided by SELECTED_LOCATION or the legacy runtime slot export file}" + export CLUSTER_PROFILE_DIR="/var/run/aro-hcp-${VAULT_SECRET_PROFILE}" export AZURE_CLIENT_ID; AZURE_CLIENT_ID=$(cat "${CLUSTER_PROFILE_DIR}/client-id") diff --git a/ci-operator/step-registry/aro-hcp/provision/environment/aro-hcp-provision-environment-ref.yaml b/ci-operator/step-registry/aro-hcp/provision/environment/aro-hcp-provision-environment-ref.yaml index 37e87309b48c8..72e571bc81f4f 100644 --- a/ci-operator/step-registry/aro-hcp/provision/environment/aro-hcp-provision-environment-ref.yaml +++ b/ci-operator/step-registry/aro-hcp/provision/environment/aro-hcp-provision-environment-ref.yaml @@ -3,6 +3,9 @@ ref: from: aro-hcp-e2e-tools commands: aro-hcp-provision-environment-commands.sh grace_period: 15s + leases: + - resource_type: aro-hcp-msi-mock-cs-sp-dev + env: LEASED_MSI_MOCK_SP resources: requests: cpu: 1000m diff --git a/ci-operator/step-registry/aro-hcp/test/local/aro-hcp-test-local-commands.sh b/ci-operator/step-registry/aro-hcp/test/local/aro-hcp-test-local-commands.sh index 6042757b59787..db9efaede7bcd 100644 --- a/ci-operator/step-registry/aro-hcp/test/local/aro-hcp-test-local-commands.sh +++ b/ci-operator/step-registry/aro-hcp/test/local/aro-hcp-test-local-commands.sh @@ -3,12 +3,23 @@ set -o errexit set -o nounset set -o pipefail +env_file="${SHARED_DIR}/aro-hcp-slot.env" +if [[ ! -f "${env_file}" ]]; then + printf 'Missing runtime lease export file: %s\n' "${env_file}" >&2 + exit 1 +fi + +# shellcheck disable=SC1090 +source "${env_file}" + +export LOCATION="${SELECTED_LOCATION:-${LOCATION:-}}" +: "${LOCATION:?LOCATION must be provided by SELECTED_LOCATION or the legacy runtime slot export file}" + export CLUSTER_PROFILE_DIR="/var/run/aro-hcp-${VAULT_SECRET_PROFILE}" export AZURE_CLIENT_ID; AZURE_CLIENT_ID=$(cat "${CLUSTER_PROFILE_DIR}/client-id") export AZURE_TENANT_ID; AZURE_TENANT_ID=$(cat "${CLUSTER_PROFILE_DIR}/tenant") export AZURE_CLIENT_SECRET; AZURE_CLIENT_SECRET=$(cat "${CLUSTER_PROFILE_DIR}/client-secret") -export CUSTOMER_SUBSCRIPTION; CUSTOMER_SUBSCRIPTION=$(cat "${CLUSTER_PROFILE_DIR}/subscription-name") export INFRA_SUBSCRIPTION_ID; INFRA_SUBSCRIPTION_ID=$(cat "${CLUSTER_PROFILE_DIR}/infra-${ARO_HCP_DEPLOY_ENV}-subscription-id") export DEPLOY_ENV="${ARO_HCP_DEPLOY_ENV}" diff --git a/ci-operator/step-registry/aro-hcp/write-config/aro-hcp-write-config-commands.sh b/ci-operator/step-registry/aro-hcp/write-config/aro-hcp-write-config-commands.sh index 2c62c7b31176f..cf44662723385 100755 --- a/ci-operator/step-registry/aro-hcp/write-config/aro-hcp-write-config-commands.sh +++ b/ci-operator/step-registry/aro-hcp/write-config/aro-hcp-write-config-commands.sh @@ -4,9 +4,21 @@ set -o nounset set -o pipefail if [[ -n "${MULTISTAGE_PARAM_OVERRIDE_LOCATION:-}" ]]; then - export LOCATION="${MULTISTAGE_PARAM_OVERRIDE_LOCATION}" + export LOCATION="${MULTISTAGE_PARAM_OVERRIDE_LOCATION}" fi +env_file="${SHARED_DIR}/aro-hcp-slot.env" +if [[ -f "${env_file}" ]]; then + # shellcheck disable=SC1090 + source "${env_file}" +fi + +if [[ -n "${SELECTED_LOCATION:-}" ]]; then + export LOCATION="${SELECTED_LOCATION}" +fi + +: "${LOCATION:?LOCATION must be set directly, via Gangway override, or by SELECTED_LOCATION in the runtime slot export file}" + export AZURE_TOKEN_CREDENTIALS=prod # NOTE: this config will be only partially accurate on public envs diff --git a/ci-operator/step-registry/aro-hcp/write-config/aro-hcp-write-config-ref.yaml b/ci-operator/step-registry/aro-hcp/write-config/aro-hcp-write-config-ref.yaml index 2f5e3dd0fb0b1..56e90d243cc78 100644 --- a/ci-operator/step-registry/aro-hcp/write-config/aro-hcp-write-config-ref.yaml +++ b/ci-operator/step-registry/aro-hcp/write-config/aro-hcp-write-config-ref.yaml @@ -21,5 +21,7 @@ ref: documentation: Config environment name (prow, int, stg, prod). timeout: 5m documentation: |- - Render config.yaml to SHARED_DIR using templatize configuration render. + Render config.yaml to SHARED_DIR using LOCATION, optionally overridden by + MULTISTAGE_PARAM_OVERRIDE_LOCATION, or the runtime slot SELECTED_LOCATION + when the slot export file is present. Note: The rendered config is only partially accurate and won't always reflect the full production configuration.