nmasse-itix / keycloak-import-realm

Generates & import data into Keycloak for performance tests

Home Page:https://www.itix.fr/writing/how-size-your-projects-red-hats-single-sign-technology/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keycloak Realm Generator & Importer

This tool is used to load data into Keycloak before running a performance test.

Usage

Generation

Generate 5 realms, each one containing 10 clients and 100 users. Generated files are saved in the current directory.

kci generate --realms 5 --clients 10 --users 100 

Same as above but save files in the specified directory.

kci generate --realms 5 --clients 10 --users 100 --target realms/

Generate realms using the provided template.

kci generate --realms 5 --clients 10 --users 100 --realm my.template

Import

Configure your target Keycloak instance.

kci config set realm --value master
kci config set login --value admin
kci config set password --value S3cr3t
kci config set keycloak_url --value http://localhost:8080/auth

Import the previously generated realms.

kci import *.json

By default, 5 workers are used to speed up the loading process. You can change this with:

kci config set workers --value 10

Container image

An up-to-date container image is built by a Tekton pipeline and pushed to quay.io/itix/kci. Images are built for x86_64, armv5 and arm64. Each tag in the git repository ends up being a tag in the Quay registry, latest being the continuous build of the main branch.

To use this tool from the command line with podman, you would need to define the following function in your .bashrc / .zshrc.

function kci () {
    touch ~/.kci.yaml
    podman run --rm -v $HOME/.kci.yaml:/.kci.yaml:z -v $PWD:/home:z -w /home quay.io/itix/kci:latest "$@"
}

Building from sources

To compile the application from sources, you can run the following commands:

export GOPATH="$HOME/go"
export GOBIN="$GOPATH/bin"
export PATH="$GOBIN:$PATH"
go install github.com/rakyll/statik
go generate ./...
go build -o kci cli/main.go

About

Generates & import data into Keycloak for performance tests

https://www.itix.fr/writing/how-size-your-projects-red-hats-single-sign-technology/

License:GNU General Public License v3.0


Languages

Language:Go 99.8%Language:Dockerfile 0.2%