Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
ahus1 authored and Anna Manukyan committed Aug 9, 2023
1 parent 9473327 commit b936f6f
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 67 deletions.
5 changes: 0 additions & 5 deletions .github/actions/ec2-create-instances/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ runs:
run: |
./aws_ec2.sh create ${{ inputs.region }}
working-directory: ansible

- id: create-load-runners
shell: bash
run: ./aws_ec2.sh start ${{ inputs.region }}
working-directory: ansible
5 changes: 0 additions & 5 deletions .github/actions/ec2-delete-instances/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ inputs:
runs:
using: composite
steps:
- id: stop-ec2-instances
shell: bash
run: ./aws_ec2.sh stop ${{ inputs.region }}
working-directory: ansible

- id: delete-load-runners
shell: bash
run: ./aws_ec2.sh delete ${{ inputs.region }}
Expand Down
14 changes: 4 additions & 10 deletions .github/actions/keycloak-create-dataset/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ inputs:
default: '1'
createClientForSpecificRealm:
description: 'Create client for realm'
type: boolean
default: false
default: 'false'
clientsPerRealm:
description: 'Number of clients per Realm.'
type: string
default: '1'
realmNameForClients:
description: 'Name of the realm'
type: string
default: 'realm-0'
maxWaitEntityCreation:
description: 'Maximum number of seconds to wait for creation of entities'
Expand All @@ -46,12 +43,9 @@ runs:
working-directory: dataset

- id: create_clients_for_realm
if: ${{ inputs.createClientForSpecificRealm }}
shell: bash
run: |
if [[ ${{ inputs.createClientForSpecificRealm }} == true ]]; then
./dataset-import.sh -a create-clients -c ${{ inputs.clientsPerRealm }} -n ${{ inputs.realmNameForClients }} -l ${{ env.KEYCLOAK_URL }}/realms/master/dataset
./dataset-import.sh -a status-completed -t ${{ inputs.maxWaitEntityCreation }} -l ${{ env.KEYCLOAK_URL }}/realms/master/dataset
else
echo "Nothing should be done here. Passed parameter is: ${{ inputs.createClientForSpecificRealm }}"
fi
./dataset-import.sh -a create-clients -c ${{ inputs.clientsPerRealm }} -n ${{ inputs.realmNameForClients }} -l ${{ env.KEYCLOAK_URL }}/realms/master/dataset
./dataset-import.sh -a status-completed -t ${{ inputs.maxWaitEntityCreation }} -l ${{ env.KEYCLOAK_URL }}/realms/master/dataset
working-directory: dataset
14 changes: 0 additions & 14 deletions .github/actions/keycloak-create-deployment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ inputs:
description: 'The hostname to be used by Keycloak'
kcHealthHostname:
description: 'The hostname used to create a health Route'
deployMonitoring:
description: 'Boolean showing if monitoring should be deployed'
type: boolean
default: false

runs:
using: "composite"
Expand All @@ -66,13 +62,3 @@ runs:
KC_DATABASE_URL: ${{ inputs.databaseUrl }}
KC_HOSTNAME_OVERRIDE: ${{ inputs.kcHostnameOverride }}
KC_HEALTH_HOSTNAME: ${{ inputs.kcHealthHostname }}

- id: install_keycloak_monitoring
shell: bash
run: |
if [[ ${{ inputs.deployMonitoring }} == true ]]; then
task monitoring
else
echo "Nothing should be done. Passed parameter is ${{ inputs.deployMonitoring }}."
fi
working-directory: provision/openshift
54 changes: 29 additions & 25 deletions .github/workflows/rosa-scaling-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@ on:
default: 'eu-west-1'
numberOfEntitiesInRealm:
description: 'Number of entities for the scenario in DB'
type: string
default: '100000'
type: number
default: 100000
maxWaitEntityCreation:
description: 'Maximum number of seconds to wait for creation of entities'
type: string
default: '900'
type: number
default: 900
numberOfUsersPerSecond:
description: 'Initial users per second'
type: string
default: '200'
description: 'User logins per second'
type: number
default: 200
numberOfClientsPerSecond:
description: 'Initial clients per second'
type: string
default: '1000'
description: 'Client credential grants per second'
type: number
default: 1000
measurement:
description: 'Measurement period (seconds)'
type: number
default: 600
skipCreateDeployment:
description: 'Skip creating Keycloak deployment'
type: boolean
Expand Down Expand Up @@ -54,6 +58,7 @@ env:
KC_DB_POOL_INITIAL_SIZE: 30
KC_DB_POOL_MAX_SIZE: 30
KC_DB_POOL_MIN_SIZE: 30
ANSIBLE_CUSTOM_VARS_ARG: '-e @env_rosa_benchmark.yml'

jobs:
run:
Expand Down Expand Up @@ -113,9 +118,13 @@ jobs:
podMemoryRequests: ${{ env.KC_MEMORY_REQUESTS_MB }}
podMemoryLimit: ${{ env.KC_MEMORY_LIMITS_MB }}
heapMaxSizeMB: ${{ env.KC_HEAP_MAX_MB }}
deployMonitoring: true

- name: Create Keycloak dataset with "${{ inputs.numberOfEntitiesInRealm }}" users
- name: Get URLs
uses: ./.github/actions/get-keycloak-url
with:
project: ${{ env.PROJECT }}

- name: Create Keycloak dataset with "${{ inputs.numberOfEntitiesInRealm }}" users and clients
if: ${{ !inputs.skipCreateDataset }}
uses: ./.github/actions/keycloak-create-dataset
with:
Expand All @@ -132,11 +141,6 @@ jobs:
with:
region: ${{ inputs.region }}

- name: Get URLs
uses: ./.github/actions/get-keycloak-url
with:
project: ${{ env.PROJECT }}

- name: Testing memory for creating sessions
id: kcb-authorization-code-1
run: |
Expand All @@ -147,8 +151,8 @@ jobs:
--users-per-sec=${{ inputs.numberOfUsersPerSecond }} \
--ramp-up=20 \
--logout-percentage=0 \
--measurement=600 \
--users-per-realm=100000 \
--measurement=${{ inputs.measurement }} \
--users-per-realm=${{ inputs.numberOfEntitiesInRealm }} \
--log-http-on-failure
working-directory: ansible

Expand All @@ -162,8 +166,8 @@ jobs:
--users-per-sec=${{ inputs.numberOfUsersPerSecond }} \
--ramp-up=20 \
--logout-percentage=100 \
--measurement=600 \
--users-per-realm=100000 \
--measurement=${{ inputs.measurement }} \
--users-per-realm=${{ inputs.numberOfEntitiesInRealm }} \
--log-http-on-failure
working-directory: ansible

Expand All @@ -176,8 +180,8 @@ jobs:
--realm-name=realm-0 \
--users-per-sec=${{ inputs.numberOfClientsPerSecond }} \
--ramp-up=20 \
--measurement=600 \
--users-per-realm=100000 \
--measurement=${{ inputs.measurement }} \
--users-per-realm=${{ inputs.numberOfEntitiesInRealm }} \
--log-http-on-failure
working-directory: ansible

Expand All @@ -196,8 +200,8 @@ jobs:
path: ansible/files/benchmark/*/results/*/js/stats.json
retention-days: 5

- name: Stop and Delete EC2 instances
if: ${{ success() || (failure() && steps.create_aws_ec2_instances.conclusion != 'skipped') }}
- name: Delete EC2 instances
if: ${{ (success() || failure()) && steps.create_aws_ec2_instances.conclusion != 'skipped' }}
uses: ./.github/actions/ec2-delete-instances
with:
region: ${{ inputs.region }}
Expand Down
4 changes: 2 additions & 2 deletions ansible/aws_ec2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ case $OPERATION in
pip3 install --user boto3 botocore
;;
create|delete|start|stop)
if [ -f "env.yml" ]; then CUSTOM_VARS_ARG="-e @env.yml"; fi
ansible-playbook aws_ec2.yml -v -e "region=$REGION" -e "operation=$OPERATION" $CUSTOM_VARS_ARG
if [ -f "env.yml" ]; then ANSIBLE_CUSTOM_VARS_ARG="-e @env.yml"; fi
ansible-playbook aws_ec2.yml -v -e "region=$REGION" -e "operation=$OPERATION" $ANSIBLE_CUSTOM_VARS_ARG "${@:3}"
;;
*)
echo "Invalid option!"
Expand Down
4 changes: 2 additions & 2 deletions ansible/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ KCB_PARAMS=${@:2}

CLUSTER_NAME=${CLUSTER_NAME:-"benchmark_$(whoami)"}

if [ -f "env.yml" ]; then CUSTOM_VARS_ARG="-e @env.yml"; fi
if [ -f "env.yml" ]; then ANSIBLE_CUSTOM_VARS_ARG="-e @env.yml"; fi

ansible-playbook -i ${CLUSTER_NAME}_${REGION}_inventory.yml benchmark.yml \
$CUSTOM_VARS_ARG \
$ANSIBLE_CUSTOM_VARS_ARG \
-e "kcb_params=\"${KCB_PARAMS}\""
5 changes: 5 additions & 0 deletions ansible/env_rosa_benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Setting use for ROSA default benchmark
cluster_size: 5
kcb_zip: ../benchmark/target/keycloak-benchmark-0.10-SNAPSHOT.zip
# GitHub actions seem to use different IP addresses for a single runner, which would then be rejected
cidr_ip: '0.0.0.0/0'
4 changes: 3 additions & 1 deletion ansible/roles/aws_ec2/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ cluster_identifier: "{{ lookup('env', 'USER') }}"
cluster_name: "benchmark_{{ cluster_identifier }}"
cluster_size: 1

cidr_ip: "{{ control_host_ip.stdout }}/32"

ami_name: RHEL-8.8.0_HVM-20230503-x86_64-54-Hourly2-GP2

instance_type: t3.micro
instance_volume_size: 20
instance_device: /dev/sda1

no_log_sensitive: yes
no_log_sensitive: yes
3 changes: 1 addition & 2 deletions ansible/roles/aws_ec2/tasks/create-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
- proto: tcp
from_port: 22
to_port: 22
# cidr_ip: '{{ control_host_ip.stdout }}/32'
cidr_ip: '0.0.0.0/0'
cidr_ip: '{{cidr_ip}}'
register: group
no_log: "{{ no_log_sensitive }}"

Expand Down
3 changes: 2 additions & 1 deletion ansible/roles/aws_ec2/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
- debug: var=cluster_identifier
- debug: var=region
- debug: var=cluster_name
- debug: var=cidr_ip

- include_tasks: create-resources.yml
when: operation == "create"

- include_tasks: manage-instances.yml
when: operation == "start" or operation == "stop"

- include_tasks: delete-resources.yml
when: operation == "delete"

0 comments on commit b936f6f

Please sign in to comment.