Skip to content

Commit

Permalink
Customize cluster name (#350)
Browse files Browse the repository at this point in the history
* Add clusterName as parameter to create cluster workflow

* Add clusterName as a parameter to Run Benchmark workflow

* Add clusterName as a parameter to Delete ROSA cluster workflow

* Add docs for dispatch-able workflows

* Address PR comments

* Change concurrency to per clusterName
  • Loading branch information
mhajas committed May 30, 2023
1 parent 9ee93ed commit 0b8502a
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 6 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Running workflows for keycloak-benchmark repository on AWS

## Create secrets and variables

1. Go to repository Settings -> Secrets and variables
2. Create new secret `AWS_ACCESS_KEY_ID` with value of your AWS access key id.
3. Create new secret `AWS_SECRET_ACCESS_KEY` with value of your AWS access key value.
4. Create new secret `ROSA_TOKEN` with value of your ROSA token. See [Red Hat OpenShift Cluster Manager API](https://cloud.redhat.com/openshift/token) for more information.
5. Create new variable `AWS_REGION` with value of your preferred AWS region, for example, `eu-central-1`.

## Create cluster

1. Go to repository Actions -> On the left side choose `ROSA Cluster - Create`
2. Click on Run workflow button
3. Fill in the form and click on Run workflow button
1. Name of the cluster - the name of the cluster that will be later used for other workflows. Default value is `gh-${{ github.repository_owner }}`, this results in `gh-<owner of fork>`.
2. Instance type for compute nodes - see [AWS EC2 instance types](https://aws.amazon.com/ec2/instance-types/). Default value is `m5.xlarge`.
3. Deploy to multiple availability zones in the region - if checked, the cluster will be deployed to multiple availability zones in the region. Default value is `false`.
4. Number of worker nodes to provision - number of compute nodes in the cluster. Default value is `2`.
4. Wait for the workflow to finish.

## Destroy cluster

1. Go to repository Actions -> On the left side choose `ROSA Cluster - Destroy`
2. Click on Run workflow button
3. Fill in the form and click on Run workflow button
1. Name of the cluster - the name of the cluster to destroy. Default value is `gh-${{ github.repository_owner }}`, this results in `gh-<owner of fork>`.
4. Wait for the workflow to finish.

## Run benchmark

1. Go to repository Actions -> On the left side choose `ROSA Cluster - Run Benchmark`
2. Click on Run workflow button
3. Fill in the form and click on Run workflow button
1. Name of the cluster - the name of the cluster that will be used for running benchmark. Default value is `gh-${{ github.repository_owner }}`, this results in `gh-<owner of fork>`.
4. The workflow will perform the following steps
1. Connect to the cluster
2. Provision new Keycloak instance including monitoring stack.
3. Create dataset with 1 realm, 1 client and 100 users.
4. Run Keycloak benchmark with `keycloak.scenario.authentication.AuthorizationCode` scenario.
5. Wait for the workflow to finish. The Gatling results will be available in the `artifacts` section of the workflow run.
7 changes: 5 additions & 2 deletions .github/workflows/rosa-cluster-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ name: ROSA Cluster - Create
on:
workflow_dispatch:
inputs:
clusterName:
description: 'Name of the cluster'
type: text
computeMachineType:
description: 'Instance type for the compute nodes'
required: true
default: m5.xlarge
type: text
multiAz:
description: 'Deploy to multiple data centers'
description: 'Deploy to multiple availability zones in the region'
required: true
default: false
type: boolean
Expand Down Expand Up @@ -44,7 +47,7 @@ jobs:
working-directory: provision/aws
env:
VERSION: ${{ env.OPENSHIFT_VERSION }}
CLUSTER_NAME: shared
CLUSTER_NAME: ${{ inputs.clusterName || format('gh-{0}', github.repository_owner) }}
REGION: ${{ vars.AWS_DEFAULT_REGION }}
COMPUTE_MACHINE_TYPE: ${{ inputs.computeMachineType }}
MULTI_AZ: ${{ inputs.multiAz }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/rosa-cluster-delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ name: ROSA Cluster - Delete

on:
workflow_dispatch:

inputs:
clusterName:
description: 'Name of the cluster'
type: text
jobs:

delete:
Expand All @@ -24,4 +27,4 @@ jobs:
run: ./rosa_delete_cluster.sh
working-directory: provision/aws
env:
CLUSTER_NAME: shared
CLUSTER_NAME: ${{ inputs.clusterName || format('gh-{0}', github.repository_owner) }}
8 changes: 7 additions & 1 deletion .github/workflows/rosa-run-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ name: ROSA Cluster - Run Benchmark

on:
workflow_dispatch:
inputs:
clusterName:
description: 'Name of the cluster'
type: text

concurrency: shared_cluster
concurrency: cluster_${{ inputs.clusterName || format('gh-{0}', github.repository_owner) }}

jobs:

Expand Down Expand Up @@ -44,6 +48,8 @@ jobs:
- name: Login to OpenShift cluster
run: ./rosa_oc_login.sh
working-directory: provision/aws
env:
CLUSTER_NAME: ${{ inputs.clusterName || format('gh-{0}', github.repository_owner) }}

- name: Build with Maven
run: |
Expand Down
2 changes: 1 addition & 1 deletion provision/aws/rosa_oc_login.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ KEYCLOAK_MASTER_PASSWORD_SECRET_NAME=${KEYCLOAK_MASTER_PASSWORD_SECRET_NAME:-"ke
# Force eu-central-1 region for secrets manager so we all work with the same secret
SECRET_MANAGER_REGION="eu-central-1"

API_URL=$(rosa describe cluster -c shared | grep 'API URL' | awk '{ print $3 }')
API_URL=$(rosa describe cluster -c "$CLUSTER_NAME" | grep 'API URL' | awk '{ print $3 }')
ADMIN_PASSWORD=$(aws secretsmanager get-secret-value --region $SECRET_MANAGER_REGION --secret-id $KEYCLOAK_MASTER_PASSWORD_SECRET_NAME --query SecretString --output text --no-cli-pager)

oc login $API_URL --username cluster-admin --password $ADMIN_PASSWORD --insecure-skip-tls-verify

0 comments on commit 0b8502a

Please sign in to comment.