|
| 1 | +# OCP Ephemeral Environment |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The RHDH deployment for end-to-end (e2e) tests in CI has been updated to use **ephemeral clusters** on OpenShift Container Platform (OCP) instead of persistent clusters. |
| 6 | + |
| 7 | +### Key Updates |
| 8 | +- Starting from version **1.5**, ephemeral clusters are used for: |
| 9 | + - OCP nightly jobs (v4.17, v4.16, and v4.14). |
| 10 | + - PR checks on the main branch. |
| 11 | +- Previously, RHDH PR checks utilized persistent clusters created on IBM Cloud. |
| 12 | +- Now, ephemeral clusters are provisioned using the **OpenShift CI cluster claim** on AWS via the RHDH-QE account in the `us-east-2` region. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## Access Requirements |
| 17 | + |
| 18 | +To access ephemeral clusters, you must: |
| 19 | +1. Be a **Cluster Pool Admin**. |
| 20 | +2. Join the **Rover Group**: [rhdh-pool-admins](https://rover.redhat.com/groups/group/rhdh-pool-admins). |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Cluster Pools |
| 25 | + |
| 26 | +The following cluster pools are available for different OCP versions: |
| 27 | + |
| 28 | +- **RHDH-4-17-US-EAST-2** |
| 29 | + - Usage: PR checks on the main branch and OCP v4.17 nightly jobs. |
| 30 | + - [Cluster Pool Configuration](https://github.com/openshift/release/blob/master/clusters/hosted-mgmt/hive/pools/rhdh/rhdh-ocp-4-17-0-amd64-aws-us-east-2_clusterpool.yaml). |
| 31 | + |
| 32 | +- **RHDH-4-16-US-EAST-2** |
| 33 | + - Usage: OCP v4.16 nightly jobs. |
| 34 | + - [Cluster Pool Configuration](https://github.com/openshift/release/blob/master/clusters/hosted-mgmt/hive/pools/rhdh/rhdh-ocp-4-16-0-amd64-aws-us-east-2_clusterpool.yaml). |
| 35 | + |
| 36 | +- **RHDH-4-15-US-EAST-2** |
| 37 | + - Usage: OCP v4.15 nightly jobs. |
| 38 | + - [Cluster Pool Configuration](https://github.com/openshift/release/blob/master/clusters/hosted-mgmt/hive/pools/rhdh/rhdh-ocp-4-15-0-amd64-aws-us-east-2_clusterpool.yaml). |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## Using Cluster Claims in OpenShift CI Jobs |
| 43 | + |
| 44 | +Ephemeral clusters can be utilized in CI jobs by defining a `cluster_claim` stanza with values matching the labels on the pool. |
| 45 | +Additionally, include the workflow: `generic-claim` for setup and cleanup. |
| 46 | + |
| 47 | +### Example Configuration |
| 48 | + |
| 49 | +```yaml |
| 50 | +- as: e2e-tests-nightly |
| 51 | + cluster_claim: |
| 52 | + architecture: amd64 |
| 53 | + cloud: aws |
| 54 | + labels: |
| 55 | + region: us-east-2 |
| 56 | + owner: rhdh |
| 57 | + product: ocp |
| 58 | + timeout: 1h0m0s |
| 59 | + version: "4.17" |
| 60 | + cron: 0 7 * * * |
| 61 | + steps: |
| 62 | + test: |
| 63 | + - ref: janus-idp-backstage-showcase-nightly |
| 64 | + workflow: generic-claim |
| 65 | +``` |
| 66 | +
|
| 67 | +
|
| 68 | +
|
| 69 | +## Debugging |
| 70 | +
|
| 71 | +If you are a member of the ```rhdh-pool-admins``` group, you can use the [.ibm/pipelines/ocp-cluster-claim-login.sh](ocp-cluster-claim-login.sh) script to log in and retrieve ephemeral environment credentials. |
| 72 | + |
| 73 | +### Steps: |
| 74 | + |
| 75 | +1. Run the script: |
| 76 | + ```bash |
| 77 | + .ibm/pipelines/ocp-cluster-claim-login.sh |
| 78 | + ``` |
| 79 | +2. Provide the Prow log URL when prompted, for example: ```https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/janus-idp_backstage-showcase/2089/pull-ci-janus-idp-backstage-showcase-main-e2e-tests/1866766753132974080 ``` |
| 80 | +3. The script will: |
| 81 | + - Log in to the hosted-mgmt cluster, which manages ephemeral cluster creation. |
| 82 | + - Retrieve admin credentials and log in to the ephemeral cluster. |
| 83 | + - Prompt to open the OCP web console directly in the browser. |
| 84 | +4. Note: |
| 85 | + - The ephemeral cluster is deleted as soon as the CI job terminates. |
| 86 | + - To retain the cluster for a longer duration, add a sleep command in the [openshift-ci-tests.sh](openshift-ci-tests.sh) script, e.g.: |
| 87 | + ```bash |
| 88 | + ... |
| 89 | + echo "Main script completed with result: ${OVERALL_RESULT}" |
| 90 | + sleep 60*60 |
| 91 | + exit "${OVERALL_RESULT}" |
| 92 | + ... |
| 93 | + ``` |
| 94 | + |
| 95 | +### For detailed documentation, refer to: [Openshift-ci cluster claim docs](https://docs.ci.openshift.org/docs/how-tos/cluster-claim/) |
| 96 | + |
| 97 | + |
| 98 | +## Keycloak Authentication for Tests |
| 99 | +- All tests on the main branch use Keycloak as the default authentication provider. |
| 100 | +- Keycloak is deployed on the pr-os cluster. |
| 101 | +### Keycloak Instance Details: |
| 102 | +- URL: [Keycloak Admin Console](https://keycloak-rhsso.rhdh-pr-os-a9805650830b22c3aee243e51d79565d-0000.us-east.containers.appdomain.cloud/auth/admin/master/console/#/realms/rhdh-login-test) |
| 103 | +- Credentials: These can be found in the RHDH-QE Vault under the following keys: |
| 104 | + - ```KEYCLOAK_AUTH_BASE_URL``` |
| 105 | + - ```KEYCLOAK_AUTH_CLIENTID``` |
| 106 | + - ```KEYCLOAK_AUTH_CLIENT_SECRET``` |
| 107 | + - ```KEYCLOAK_AUTH_LOGIN_REALM``` |
| 108 | + - ```KEYCLOAK_AUTH_REALM``` |
| 109 | + |
1 | 110 | # Installation Instructions for Tests
|
2 | 111 |
|
3 | 112 | For tests dependent on `backstage-community-plugin-ocm-backend-dynamic` and `backstage-community-plugin-ocm`, it's necessary to install **Advanced Cluster Management for Kubernetes "MultiClusterHub"**.
|
|
0 commit comments