Skip to content

Commit c773a5f

Browse files
committed
feat(RHIDP-845): Add guidelines into README.md
Signed-off-by: Pavel Macík <pavel.macik@gmail.com>
1 parent 4ac9961 commit c773a5f

File tree

1 file changed

+107
-6
lines changed

1 file changed

+107
-6
lines changed

README.md

Lines changed: 107 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,112 @@
22

33
## Prerequisites
44

5-
* Python 3
6-
* `pip`
7-
* `jq`
8-
* `kubectl`
9-
* `helm`
5+
Ensure your system has all the CLI and tools as shown in the [OpenShift CI runner Containerfile](https://github.com/openshift/release/blob/master/ci-operator/config/redhat-performance/backstage-performance/redhat-performance-backstage-performance-main.yaml#L7) or compatible versions.
106

117
## How to...
12-
Everything is driven by [`Makefile`](./Makefile). For the details how to do various things see the [`Makefile`](./Makefile)'s inline comments or run `make help`.
8+
Everything is driven by [`Makefile`](./Makefile). For the details how to do various things see the [`Makefile`](./Makefile)'s inline comments or run `make help`.
9+
10+
11+
## Setup the environment
12+
13+
The RHDH performance testing framework is optimized to run in OpenShift CI environment where secrets are provided to the environment via files stored under `/usr/local/ci-secrets/backstage-performance` directory. (See [OpenShift CI Docs](https://docs.ci.openshift.org/docs/how-tos/adding-a-new-secret-to-ci/))
14+
15+
The framework assumes the following credentials files under the `/usr/local/ci-secrets/backstage-performance` directory with secrets exists and maps them to the following environment variables:
16+
17+
| Credential file | Mapped environment Variable | Description | Example |
18+
| :--- | ---- | ---- | ---- |
19+
| github.accounts | Used to mitigate Github rate limits attemtps. | Comma separated list of colon separated tuples of Github username and token | `gh_user1:ghp_token1,gh_user2:ghp_token2`. |
20+
| github.org | GITHUB_ORG | Name of the Github organization. Used to clean the test repos branches created for RHDH Catalog locations.| `example-org` |
21+
| github.repo | GITHUB_REPO | URL of the Github Repo used for creating RHDH catalog locations. |`https://github.com/example-org/rhdh-perf-testing-repo.git` |
22+
| github.user | GITHUB_USER | Github username with permissions to the above github repo | `gh_user1` |
23+
| github.token | GITHUB_TOKEN | Personal access token (classic) of the above Github user with the `delete_repo, repo, workflow` permissions | `ghp_token1` |
24+
| quay.token | QUAY_TOKEN | A pull secret for getting RHDH (and other) images from Quay.io (and other registries). A base64 encoded docker.json config file | - |
25+
26+
Make sure to create the `/usr/local/ci-secrets/backstage-performance` directory in your system where you intend to run the RHDH performance framework and create and fill the above files with the respective credentials.
27+
28+
Additionally, make sure you have an OpenShift cluster with the admin permissions to it and you have exported the appropriate `KUBECONFIG` environmental variable for the performance framework to be able to access it.
29+
30+
# Running the RHDH performance tests
31+
32+
The framework operations are divided into 3 phases:
33+
* Setup
34+
* Test
35+
* Collect results
36+
37+
## Testing RHDH performance
38+
The RHDH is deployed on the OpenShift cluster provisioned on AWS along with the load generating framework simulating concurrent active users interacting with RHDH from multiple places.
39+
40+
RHDH is installed using Helm chart (or OLM operator) with KeyCloak used both as identity provider and OAuth2 server. Both RHDH and KeyCloak have their own PostgreSQL DB all deployed on OpenShift in a single namespace (`rhdh-performance` by default). RHDH has an additional container with `oauth2-proxy` to make the API secure. The test users and groups are created in KeyCloak and the entities are added to the RHDH Catalog during installation.
41+
42+
The load generating part is driven by the [Locust.io Operator](https://abdelrhmanhamouda.github.io/locust-k8s-operator/getting_started/) deployed in the `locust-operator` namespace by default.
43+
44+
The central configuration to control the setup and the performance test itself is the `test.env` file where all the configuration is provided.
45+
46+
To install RHDH and populate the DB with test users, groups and catalog entities:
47+
48+
1. Create `.setenv.local` file with the following content:
49+
```#!/bin/bash
50+
51+
export GITHUB_TOKEN
52+
export GITHUB_USER
53+
export GITHUB_REPO
54+
export QUAY_TOKEN
55+
56+
GITHUB_TOKEN="$(cat /usr/local/ci-secrets/backstage-performance/github.token)"
57+
GITHUB_USER="$(cat /usr/local/ci-secrets/backstage-performance/github.user)"
58+
GITHUB_REPO="$(cat /usr/local/ci-secrets/backstage-performance/github.repo)"
59+
QUAY_TOKEN="$(cat /usr/local/ci-secrets/backstage-performance/quay.token)"
60+
```
61+
62+
2. Uncomment and set at least the following variables in the `test.env`
63+
```
64+
# Test phase
65+
export SCENARIO=mvp
66+
export USERS=10
67+
export WORKERS=100
68+
export DURATION=10m
69+
export SPAWN_RATE=20
70+
export WAIT_FOR_SEARCH_INDEX=false
71+
72+
# Setup phase
73+
export PRE_LOAD_DB=true
74+
export BACKSTAGE_USER_COUNT=100
75+
export GROUP_COUNT=25
76+
export API_COUNT=250
77+
export COMPONENT_COUNT=250
78+
export KEYCLOAK_USER_PASS=changeme
79+
export AUTH_PROVIDER=keycloak
80+
81+
export RHDH_INSTALL_METHOD=helm
82+
export RHDH_HELM_CHART_VERSION=1.8-164-CI
83+
84+
export RHDH_DEPLOYMENT_REPLICAS=1
85+
export RHDH_DB_REPLICAS=1
86+
export RHDH_DB_STORAGE=2Gi
87+
export RHDH_KEYCLOAK_REPLICAS=1
88+
89+
export ENABLE_RBAC=true
90+
export ENABLE_ORCHESTRATOR=true
91+
92+
export RHDH_LOG_LEVEL=debug
93+
```
94+
95+
### [Setup phase] To setup RHDH and populate DB run the following command:
96+
```bash
97+
source .setenv.local;
98+
make clean-all |& tee clean.log;
99+
./ci-scripts/setup.sh |& tee setup.log;
100+
```
101+
102+
The intermediate files useful for debugging are stored under `.tmp` directory.
103+
104+
### [Test phase] To execute a single performance test run the following the command:
105+
```bash
106+
./ci-scripts/test.sh |& tee test.log;
107+
```
108+
109+
### [Collect Results phase] To collect the resutls and metrics run the following command:
110+
```bash
111+
/ci-scripts/collect-results.sh |& tee collect-results.log
112+
```
113+
The artifacts are collected and stored in a directory specified by the `ARTIFACT_DIR` environment variable (`.artifacts` being the default)

0 commit comments

Comments
 (0)