From 02698b36188ba0f35c5082763ee74883082b3ff7 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Thu, 23 Jan 2025 21:17:48 -0800 Subject: [PATCH 1/9] feat: send results reports via email --- .../publish-image-benchmark-runner.yml | 1 + benchmark/.env.example | 6 ++ benchmark/Dockerfile | 8 ++- benchmark/Makefile | 29 +++++---- {docs => benchmark}/benchmark-guide.md | 0 benchmark/entrypoint.sh | 39 ++++++++++++ benchmark/openshift/dc.yaml | 61 +++++++++++++++---- 7 files changed, 120 insertions(+), 24 deletions(-) create mode 100644 benchmark/.env.example rename {docs => benchmark}/benchmark-guide.md (100%) create mode 100755 benchmark/entrypoint.sh diff --git a/.github/workflows/publish-image-benchmark-runner.yml b/.github/workflows/publish-image-benchmark-runner.yml index 5517a859..906e0434 100644 --- a/.github/workflows/publish-image-benchmark-runner.yml +++ b/.github/workflows/publish-image-benchmark-runner.yml @@ -5,6 +5,7 @@ on: branches: - main - dev + - SSOTEAM-2187-01 paths: - 'benchmark/**' - '.github/workflows/publish-image-benchmark-runner.yml' diff --git a/benchmark/.env.example b/benchmark/.env.example new file mode 100644 index 00000000..4e17d75a --- /dev/null +++ b/benchmark/.env.example @@ -0,0 +1,6 @@ +SERVER_URL= +CHES_CLIENT_ID= +CHES_CLIENT_SECRET= +RECEPIENT= +ADMIN_USERNAME= +ADMIN_PASSWORD= diff --git a/benchmark/Dockerfile b/benchmark/Dockerfile index 89580182..391ea20a 100644 --- a/benchmark/Dockerfile +++ b/benchmark/Dockerfile @@ -17,6 +17,10 @@ RUN rm ${KEYCLOAK_BENCHMARK_VERSION}.tar.gz RUN chmod +x /app/${KEYCLOAK_BENCHMARK_VERSION}/bin/*.sh -WORKDIR /app/${KEYCLOAK_BENCHMARK_VERSION}/bin +WORKDIR /app/${KEYCLOAK_BENCHMARK_VERSION} -ENTRYPOINT ["./kcb.sh"] +COPY ./entrypoint.sh ./ + +RUN chmod +x /app/${KEYCLOAK_BENCHMARK_VERSION}/entrypoint.sh + +ENTRYPOINT ["./entrypoint.sh"] diff --git a/benchmark/Makefile b/benchmark/Makefile index 6d6bc1a0..6b85366e 100644 --- a/benchmark/Makefile +++ b/benchmark/Makefile @@ -1,21 +1,28 @@ +include .env + SHELL := /usr/bin/env bash -NAMESPACE := +NAME := sso-benchmark-runner +NAMESPACE := c6af30-dev SCENARIO := keycloak.scenario.authentication.AuthorizationCode -SERVER_URL := -ADMIN_USERNAME := -ADMIN_PASSWORD := - -# make sure scenario is set to the correct value -# test #1 - 34 users per second for 30 minutes (1800 seconds) with 101 users per realm and 101 clients per realm -ADDITIONAL_CONFIG := "--users-per-sec=34 --ramp-up=300 --users-per-realm=101 --measurement=1800 --clients-per-realm=101" +ADDITIONAL_CONFIG := "--measurement=30" # make NAMESPACE="" .PHONY: run_job run_job: - oc -n $(NAMESPACE) process -f ./openshift/dc.yaml -p SCENARIO=$(SCENARIO) -p SERVER_URL=$(SERVER_URL) -p ADMIN_USERNAME=$(ADMIN_USERNAME) -p ADMIN_PASSWORD=$(ADMIN_PASSWORD) -p ADDITIONAL_CONFIG=$(ADDITIONAL_CONFIG)| oc -n $(NAMESPACE) apply -f - + oc -n $(NAMESPACE) process -f ./openshift/dc.yaml \ + -p SCENARIO=$(SCENARIO) \ + -p SERVER_URL=$(SERVER_URL) \ + -p ADMIN_USERNAME=$(ADMIN_USERNAME) \ + -p ADMIN_PASSWORD=$(ADMIN_PASSWORD) \ + -p ADDITIONAL_CONFIG=$(ADDITIONAL_CONFIG) \ + -p CHES_CLIENT_ID=$(CHES_CLIENT_ID) \ + -p CHES_CLIENT_SECRET=$(CHES_CLIENT_SECRET) \ + -p RECEPIENT=$(RECEPIENT) \ + -p NAME=$(NAME) + | oc -n $(NAMESPACE) apply -f - .PHONY: cleanup cleanup: - oc -n $(NAMESPACE) delete job sso-benchmark-runner - oc -n $(NAMESPACE) delete pvc sso-benchmark-runner-pvc + oc -n $(NAMESPACE) delete job $(NAME) + oc -n $(NAMESPACE) delete secret $(NAME)-secret diff --git a/docs/benchmark-guide.md b/benchmark/benchmark-guide.md similarity index 100% rename from docs/benchmark-guide.md rename to benchmark/benchmark-guide.md diff --git a/benchmark/entrypoint.sh b/benchmark/entrypoint.sh new file mode 100755 index 00000000..147f6c8e --- /dev/null +++ b/benchmark/entrypoint.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Configuration +SENDER="bcgov.sso@gov.bc.ca" +SUBJECT="Keycloak Benchmark Results - $(date +'%Y-%m-%d %H:%M:%S')" +BODY="Please find the attached benchmark results.\nYou need to base64 decode the attached file (base64 -d -i results.tar.gz) before extracting it.\nRegards,\nBCGov SSO Team" +RESULTS_DIR="./results" +ATTACHMENT_NAME="results.tar.gz" + +./bin/kcb.sh --scenario="$SCENARIO" --server-url="$SERVER_URL" --admin-username="$ADMIN_USERNAME" --admin-password="$ADMIN_PASSWORD" $ADDITIONAL_CONFIG + +if [ -d "$RESULTS_DIR" ]; then + + if [ -f "$ATTACHMENT_NAME" ]; then + rm "$ATTACHMENT_NAME" + fi + + tar -czvf "$ATTACHMENT_NAME" "$RESULTS_DIR" + + if [ $? -eq 0 ]; then + echo "Folder '$RESULTS_DIR' compressed successfully to '$ATTACHMENT_NAME'." + + echo "Getting access token from '$TOKEN_URL'." + + # Get the access token + ACCESS_TOKEN=$(curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=$CHES_CLIENT_ID" -d "client_secret=$CHES_CLIENT_SECRET" -d "grant_type=client_credentials" "$CHES_TOKEN_URL" | jq -r '.access_token') + + BASE64_DATA=$(base64 -i $ATTACHMENT_NAME) + + echo '{"from": "'"$SENDER"'", "to": ["'"$RECEPIENT"'"], "subject": "'"$SUBJECT"'", "body": "'"$BODY"'", "bodyType": "text", "attachments": [{"filename": "'"$ATTACHMENT_NAME"'", "content": "'"$BASE64_DATA"'"}]}' | curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" --data-binary @- "$MAIL_SERVER" + + else + echo "Error: Failed to compress folder '$RESULTS_DIR'." + fi +else + echo "Folder '$RESULTS_DIR' does not exist." +fi + +exit 0 diff --git a/benchmark/openshift/dc.yaml b/benchmark/openshift/dc.yaml index 0428e474..566a7b55 100644 --- a/benchmark/openshift/dc.yaml +++ b/benchmark/openshift/dc.yaml @@ -2,17 +2,17 @@ kind: Template apiVersion: v1 objects: - apiVersion: v1 - kind: PersistentVolumeClaim + kind: Secret metadata: - name: ${NAME}-pvc - spec: - accessModes: - - ReadWriteMany - storageClassName: netapp-file-standard - volumeMode: Filesystem - resources: - requests: - storage: 200Mi + name: ${NAME}-secret + type: Opaque + stringData: + admin-username: ${ADMIN_USERNAME} + admin-password: ${ADMIN_PASSWORD} + ches-client-id: ${CHES_CLIENT_ID} + ches-client-secret: ${CHES_CLIENT_SECRET} + ches-token-url: ${CHES_TOKEN_URL} + mail-server: ${MAIL_SERVER} - apiVersion: batch/v1 kind: Job spec: @@ -42,6 +42,37 @@ objects: requests: cpu: 500m memory: 500Mi + env: + - name: MAIL_SERVER + valueFrom: + secretKeyRef: + name: ${NAME}-secret + key: mail-server + - name: CHES_TOKEN_URL + valueFrom: + secretKeyRef: + name: ${NAME}-secret + key: ches-token-url + - name: CHES_CLIENT_ID + valueFrom: + secretKeyRef: + name: ${NAME}-secret + key: ches-client-id + - name: CHES_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: ${NAME}-secret + key: ches-client-secret + - name: ADMIN_USERNAME + valueFrom: + secretKeyRef: + name: ${NAME}-secret + key: admin-username + - name: ADMIN_PASSWORD + valueFrom: + secretKeyRef: + name: ${NAME}-secret + key: admin-password volumeMounts: - name: ${NAME}-pvc mountPath: /app/${KEYCLOAK_BENCHMARK_VERSION}/results @@ -53,7 +84,7 @@ objects: component: ${NAME}-job parameters: - name: NAME - value: sso-benchmark-runner + description: The name of the job - name: IMAGE_TAG value: dev - name: IMAGE_REPOSITORY @@ -71,3 +102,11 @@ parameters: description: The admin password - name: ADDITIONAL_CONFIG description: Configuration set of parameters for the test + - name: CHES_CLIENT_ID + description: The CHES client ID + - name: CHES_CLIENT_SECRET + description: The CHES client secret + - name: CHES_TOKEN_URL + description: The CHES token URL + - name: MAIL_SERVER + description: The mail server From a0be0f8582574b1b2f3058440053ae230ff45689 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Thu, 23 Jan 2025 21:31:20 -0800 Subject: [PATCH 2/9] feat: minor fixes --- benchmark/Dockerfile | 2 ++ benchmark/Makefile | 2 +- benchmark/openshift/dc.yaml | 17 ++++------------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/benchmark/Dockerfile b/benchmark/Dockerfile index 391ea20a..1a3696d0 100644 --- a/benchmark/Dockerfile +++ b/benchmark/Dockerfile @@ -5,6 +5,8 @@ RUN apt-get update \ ENV KEYCLOAK_BENCHMARK_VERSION=keycloak-benchmark-0.15-SNAPSHOT +RUN chmod -R 777 /app + # Set working directory WORKDIR /app diff --git a/benchmark/Makefile b/benchmark/Makefile index 6b85366e..f6a1b36d 100644 --- a/benchmark/Makefile +++ b/benchmark/Makefile @@ -19,7 +19,7 @@ run_job: -p CHES_CLIENT_ID=$(CHES_CLIENT_ID) \ -p CHES_CLIENT_SECRET=$(CHES_CLIENT_SECRET) \ -p RECEPIENT=$(RECEPIENT) \ - -p NAME=$(NAME) + -p NAME=$(NAME) \ | oc -n $(NAMESPACE) apply -f - .PHONY: cleanup diff --git a/benchmark/openshift/dc.yaml b/benchmark/openshift/dc.yaml index 566a7b55..090e6f8a 100644 --- a/benchmark/openshift/dc.yaml +++ b/benchmark/openshift/dc.yaml @@ -21,20 +21,10 @@ objects: metadata: creationTimestamp: null spec: - volumes: - - name: ${NAME}-pvc - persistentVolumeClaim: - claimName: ${NAME}-pvc containers: - image: ${IMAGE_REPOSITORY}:${IMAGE_TAG} imagePullPolicy: Always name: ${NAME} - args: - - --scenario=${SCENARIO} - - --server-url=${SERVER_URL} - - --admin-username=${ADMIN_USERNAME} - - --admin-password=${ADMIN_PASSWORD} - - ${ADDITIONAL_CONFIG} resources: limits: cpu: 2 @@ -73,9 +63,8 @@ objects: secretKeyRef: name: ${NAME}-secret key: admin-password - volumeMounts: - - name: ${NAME}-pvc - mountPath: /app/${KEYCLOAK_BENCHMARK_VERSION}/results + - name: RECEPIENT + value: ${RECEPIENT} restartPolicy: Never metadata: name: ${NAME} @@ -110,3 +99,5 @@ parameters: description: The CHES token URL - name: MAIL_SERVER description: The mail server + - name: RECEPIENT + description: The email address to send the report to From 8ab8326926a61a77bdd3b4cd7ab9b69aef937010 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Thu, 23 Jan 2025 23:09:05 -0800 Subject: [PATCH 3/9] fix: permission issue --- benchmark/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/Dockerfile b/benchmark/Dockerfile index 1a3696d0..5bc30166 100644 --- a/benchmark/Dockerfile +++ b/benchmark/Dockerfile @@ -5,8 +5,6 @@ RUN apt-get update \ ENV KEYCLOAK_BENCHMARK_VERSION=keycloak-benchmark-0.15-SNAPSHOT -RUN chmod -R 777 /app - # Set working directory WORKDIR /app @@ -19,6 +17,8 @@ RUN rm ${KEYCLOAK_BENCHMARK_VERSION}.tar.gz RUN chmod +x /app/${KEYCLOAK_BENCHMARK_VERSION}/bin/*.sh +RUN chmod -R 777 /app/${KEYCLOAK_BENCHMARK_VERSION} + WORKDIR /app/${KEYCLOAK_BENCHMARK_VERSION} COPY ./entrypoint.sh ./ From 5d53916f79085eef58403522b9e7ec04a028bf4b Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Thu, 23 Jan 2025 23:36:57 -0800 Subject: [PATCH 4/9] fix: missing env vars --- benchmark/Makefile | 2 ++ benchmark/entrypoint.sh | 2 +- benchmark/openshift/dc.yaml | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/benchmark/Makefile b/benchmark/Makefile index f6a1b36d..7f33af75 100644 --- a/benchmark/Makefile +++ b/benchmark/Makefile @@ -20,6 +20,8 @@ run_job: -p CHES_CLIENT_SECRET=$(CHES_CLIENT_SECRET) \ -p RECEPIENT=$(RECEPIENT) \ -p NAME=$(NAME) \ + -p MAIL_SERVER=$(MAIL_SERVER) \ + -p CHES_TOKEN_URL=$(CHES_TOKEN_URL) \ | oc -n $(NAMESPACE) apply -f - .PHONY: cleanup diff --git a/benchmark/entrypoint.sh b/benchmark/entrypoint.sh index 147f6c8e..6b15238c 100755 --- a/benchmark/entrypoint.sh +++ b/benchmark/entrypoint.sh @@ -20,7 +20,7 @@ if [ -d "$RESULTS_DIR" ]; then if [ $? -eq 0 ]; then echo "Folder '$RESULTS_DIR' compressed successfully to '$ATTACHMENT_NAME'." - echo "Getting access token from '$TOKEN_URL'." + echo "Getting access token from '$CHES_TOKEN_URL'." # Get the access token ACCESS_TOKEN=$(curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=$CHES_CLIENT_ID" -d "client_secret=$CHES_CLIENT_SECRET" -d "grant_type=client_credentials" "$CHES_TOKEN_URL" | jq -r '.access_token') diff --git a/benchmark/openshift/dc.yaml b/benchmark/openshift/dc.yaml index 090e6f8a..5a57de07 100644 --- a/benchmark/openshift/dc.yaml +++ b/benchmark/openshift/dc.yaml @@ -65,6 +65,12 @@ objects: key: admin-password - name: RECEPIENT value: ${RECEPIENT} + - name: SCENARIO + value: ${SCENARIO} + - name: SERVER_URL + value: ${SERVER_URL} + - name: ADDITIONAL_CONFIG + value: ${ADDITIONAL_CONFIG} restartPolicy: Never metadata: name: ${NAME} From 9e8a143cb95781ea3660b5077a9cec06fe9babed Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Fri, 24 Jan 2025 14:50:18 -0800 Subject: [PATCH 5/9] fix: line breaks in json payload --- benchmark/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/entrypoint.sh b/benchmark/entrypoint.sh index 6b15238c..67d151ad 100755 --- a/benchmark/entrypoint.sh +++ b/benchmark/entrypoint.sh @@ -3,7 +3,7 @@ # Configuration SENDER="bcgov.sso@gov.bc.ca" SUBJECT="Keycloak Benchmark Results - $(date +'%Y-%m-%d %H:%M:%S')" -BODY="Please find the attached benchmark results.\nYou need to base64 decode the attached file (base64 -d -i results.tar.gz) before extracting it.\nRegards,\nBCGov SSO Team" +BODY="Please find the attached benchmark results. You need to base64 decode the attached file before extracting it." RESULTS_DIR="./results" ATTACHMENT_NAME="results.tar.gz" @@ -25,7 +25,7 @@ if [ -d "$RESULTS_DIR" ]; then # Get the access token ACCESS_TOKEN=$(curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=$CHES_CLIENT_ID" -d "client_secret=$CHES_CLIENT_SECRET" -d "grant_type=client_credentials" "$CHES_TOKEN_URL" | jq -r '.access_token') - BASE64_DATA=$(base64 -i $ATTACHMENT_NAME) + BASE64_DATA=$(base64 -w 0 $ATTACHMENT_NAME) echo '{"from": "'"$SENDER"'", "to": ["'"$RECEPIENT"'"], "subject": "'"$SUBJECT"'", "body": "'"$BODY"'", "bodyType": "text", "attachments": [{"filename": "'"$ATTACHMENT_NAME"'", "content": "'"$BASE64_DATA"'"}]}' | curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" --data-binary @- "$MAIL_SERVER" From 0d619b02543180073eba37818aec50a4f459a5eb Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Fri, 24 Jan 2025 20:34:20 -0800 Subject: [PATCH 6/9] feat: updated the documentation --- .../publish-image-benchmark-runner.yml | 1 - benchmark/.env.example | 4 +++ benchmark/benchmark-guide.md | 35 +++++++++++++++++-- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-image-benchmark-runner.yml b/.github/workflows/publish-image-benchmark-runner.yml index 906e0434..5517a859 100644 --- a/.github/workflows/publish-image-benchmark-runner.yml +++ b/.github/workflows/publish-image-benchmark-runner.yml @@ -5,7 +5,6 @@ on: branches: - main - dev - - SSOTEAM-2187-01 paths: - 'benchmark/**' - '.github/workflows/publish-image-benchmark-runner.yml' diff --git a/benchmark/.env.example b/benchmark/.env.example index 4e17d75a..6aa48dfe 100644 --- a/benchmark/.env.example +++ b/benchmark/.env.example @@ -4,3 +4,7 @@ CHES_CLIENT_SECRET= RECEPIENT= ADMIN_USERNAME= ADMIN_PASSWORD= +ADDITIONAL_CONFIG="--measurement=30" +CHES_TOKEN_URL= +MAIL_SERVER= +SCENARIO=keycloak.scenario.authentication.AuthorizationCode diff --git a/benchmark/benchmark-guide.md b/benchmark/benchmark-guide.md index 615c70f1..c51a9aca 100644 --- a/benchmark/benchmark-guide.md +++ b/benchmark/benchmark-guide.md @@ -27,19 +27,48 @@ GET https://${KC_BASE_URL}/auth/realms/master/dataset/create-clients?count=400&r GET https://${KC_BASE_URL}/auth/realms/master/dataset/status ``` -## Benchmark +## Running the Tests + +#### Pre-requisites + +- Java 21 if running locally +- Access to Openshift cluster if running in a pod +- CHES service account +- Test instance of keycloak pre-loaded with test data using dataset + +### Locally - without entrypoint.sh - Download the benchmark test suite from `https://github.com/keycloak/keycloak-benchmark/releases/download/0.15-SNAPSHOT/keycloak-benchmark-0.15-SNAPSHOT.tar.gz` - Extract the folder and run ```sh +export SCENARIO= +export SERVER_URL= +export ADMIN_USERNAME= +export ADMIN_PASSWORD= + # using 100 users and 100 clients to make 34 req/s for a duration of upto 30 mins -./bin/kcb.sh --scenario=keycloak.scenario.authentication.AuthorizationCode --server-url=${KC_BASE_URL}/auth --admin-username=xxx --admin-password=xxxx --users-per-sec=34 --ramp-up=300 --users-per-realm=101 --measurement=1800 --clients-per-realm=101 +./bin/kcb.sh --scenario=${SCENARIO} --server-url=${SERVER_URL}/auth --admin-username=${ADMIN_USERNAME} --admin-password=${ADMIN_PASSWORD} --users-per-sec=34 --ramp-up=300 --users-per-realm=101 --measurement=1800 --clients-per-realm=101 ``` +### Locally - with entrypoint.sh + +- Create `.env` from `.env.example` and set the appropriate values for the variables +- Run `./entrypoint.sh` + +### Openshift Pod + +- Create `.env` from `.env.example` and set the appropriate values for the variables +- Ensure you are logged onto the Openshift cluster +- Run `make cleanup` to ensure old resources get deleted +- Run `make run_job` to deploy a secret and a job that executes `entrypoint.sh` script in a pod + ## Reports -- The html report will be generated under the `./results` directory +- The html report will be generated under the `./results` directory if running locally without using `entrypoint.sh` +- Running `entrypoint.sh` locally or in a pod would send the report via email to the email address set under `RECEPIENT` environment variable +- Download the attachment from the email and use `base64 --decode` to decode the file +- After the decode, you can extract the contents from the archive ## References From fb01b757e45bc2a4a3ee036569ecba53f17d695d Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Mon, 27 Jan 2025 09:28:07 -0800 Subject: [PATCH 7/9] fix: tiny fix --- benchmark/.env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/.env.example b/benchmark/.env.example index 6aa48dfe..49a69651 100644 --- a/benchmark/.env.example +++ b/benchmark/.env.example @@ -1,7 +1,7 @@ SERVER_URL= CHES_CLIENT_ID= CHES_CLIENT_SECRET= -RECEPIENT= +RECEPIENT= ADMIN_USERNAME= ADMIN_PASSWORD= ADDITIONAL_CONFIG="--measurement=30" From 82f38114e7c78c2b5f71ba9fe2854ba031b0b47f Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Mon, 27 Jan 2025 09:31:24 -0800 Subject: [PATCH 8/9] fix: tiny fixes --- benchmark/.env.example | 2 ++ benchmark/Makefile | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/benchmark/.env.example b/benchmark/.env.example index 49a69651..48d2d887 100644 --- a/benchmark/.env.example +++ b/benchmark/.env.example @@ -8,3 +8,5 @@ ADDITIONAL_CONFIG="--measurement=30" CHES_TOKEN_URL= MAIL_SERVER= SCENARIO=keycloak.scenario.authentication.AuthorizationCode +NAME=sso-benchmark-runner +NAMESPACE= diff --git a/benchmark/Makefile b/benchmark/Makefile index 7f33af75..6aef34be 100644 --- a/benchmark/Makefile +++ b/benchmark/Makefile @@ -1,10 +1,6 @@ include .env SHELL := /usr/bin/env bash -NAME := sso-benchmark-runner -NAMESPACE := c6af30-dev -SCENARIO := keycloak.scenario.authentication.AuthorizationCode -ADDITIONAL_CONFIG := "--measurement=30" # make NAMESPACE="" From 6eb3047f453ec1e2d223d497e5a3db6c61be6709 Mon Sep 17 00:00:00 2001 From: Nithin Shekar Kuruba Date: Mon, 27 Jan 2025 09:59:22 -0800 Subject: [PATCH 9/9] fix: updated docs about the building images --- .../publish-image-keycloak-benchmark.yml | 4 +--- benchmark/benchmark-guide.md | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-image-keycloak-benchmark.yml b/.github/workflows/publish-image-keycloak-benchmark.yml index a7e6010a..b4f57230 100644 --- a/.github/workflows/publish-image-keycloak-benchmark.yml +++ b/.github/workflows/publish-image-keycloak-benchmark.yml @@ -1,9 +1,7 @@ name: Create and publish Benchmark Keycloak Docker image on: - push: - branches: - - 'feature/quarkus' + workflow_dispatch: env: GITHUB_REGISTRY: ghcr.io diff --git a/benchmark/benchmark-guide.md b/benchmark/benchmark-guide.md index c51a9aca..08dcbcc3 100644 --- a/benchmark/benchmark-guide.md +++ b/benchmark/benchmark-guide.md @@ -1,5 +1,21 @@ # Benchmark Guide +## Building Images + +### Server Image + +- You need a keycloak server with dataset provider added to be able to use it for generating test data +- To build such server image, run `.github/workflows/publish-image-keycloak-benchmark.yml` that builds an image using `docker/keycloak/Dockerfile-26-perf` that explicitly copies `docker/keycloak/dataset-providers/keycloak-benchmark-dataset-0.15-SNAPSHOT.jar` provider +- Deploy keycloak server run from this image **ONLY** in a test namespace +- After the testing is complete, uninstall the server from the namespace + +### Runner Image + +- The runner image is required if you need to run benchmark tests against test keycloak server in an openshift pod +- The image can be built using `.github/workflows/publish-image-benchmark-runner.yml` that uses `benchmark/Dockerfile` +- Existing image `sso-benchmark-runner:dev` can be used and if not found, re-build the image +- The instructions for running the benchmark runner are provided [here](#running-the-tests) + ## Dataset - The dataset is required to pre-populate realms, clients, and users in Keycloak under test