-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ocp templates for keycloak benchmark
- Loading branch information
1 parent
b3b5ca8
commit 01e5d50
Showing
4 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Create and publish Benchmark Runner Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
- SSOTEAM-2187 | ||
paths: | ||
- 'benchmark/**' | ||
- '.github/workflows/publish-image-benchmark-runner.yml' | ||
|
||
env: | ||
GITHUB_REGISTRY: ghcr.io | ||
REDHAT_REGISTRY: registry.redhat.io | ||
IMAGE_NAME: bcgov/sso-benchmark-runner | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to the GitHub Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.GITHUB_REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: benchmark | ||
push: true | ||
tags: ${{ env.GITHUB_REGISTRY }}/${{env.IMAGE_NAME}}:dev | ||
file: benchmark/Dockerfile | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
|
||
# Temp fix | ||
# https://github.com/docker/build-push-action/issues/252 | ||
# https://github.com/moby/buildkit/issues/1896 | ||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM eclipse-temurin:21 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y wget tar gzip bash jq uuid-runtime curl | ||
|
||
ENV KEYCLOAK_BENCHMARK_VERSION=keycloak-benchmark-0.15-SNAPSHOT | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
RUN wget https://github.com/keycloak/keycloak-benchmark/releases/download/0.15-SNAPSHOT/${KEYCLOAK_BENCHMARK_VERSION}.tar.gz | ||
|
||
# Extract the archive | ||
RUN tar -xzf ${KEYCLOAK_BENCHMARK_VERSION}.tar.gz | ||
|
||
RUN rm ${KEYCLOAK_BENCHMARK_VERSION}.tar.gz | ||
|
||
RUN chmod +x /app/${KEYCLOAK_BENCHMARK_VERSION}/bin/*.sh | ||
|
||
WORKDIR /app/${KEYCLOAK_BENCHMARK_VERSION}/bin | ||
|
||
ENTRYPOINT ["./kcb.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
SHELL := /usr/bin/env bash | ||
|
||
# make <comand> NAMESPACE="<namespace>" | ||
|
||
.PHONY: run_job | ||
run_job: | ||
oc -n $(NAMESPACE) process -f ./openshift/dc.yaml | 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
kind: Template | ||
apiVersion: v1 | ||
objects: | ||
- apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: ${NAME}-pvc | ||
spec: | ||
accessModes: | ||
- ReadWriteMany | ||
storageClassName: netapp-file-standard | ||
resources: | ||
requests: | ||
storage: 200Mi | ||
- apiVersion: batch/v1 | ||
kind: Job | ||
spec: | ||
backoffLimit: 0 | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
spec: | ||
volumes: | ||
- name: ${NAME}-pvc | ||
persistentVolumeClaim: | ||
claimName: ${NAME}-pvc | ||
containers: | ||
- image: ${IMAGE_REPOSITORY}:${IMAGE_TAG} | ||
name: ${NAME} | ||
args: | ||
- ${CONFIG} | ||
resources: | ||
limits: | ||
cpu: 2 | ||
memory: 5Gi | ||
requests: | ||
cpu: 500m | ||
memory: 500Mi | ||
volumeMounts: | ||
- name: ${NAME}-pvc | ||
mountPath: /app/${KEYCLOAK_BENCHMARK_VERSION}/results | ||
restartPolicy: Never | ||
metadata: | ||
name: ${NAME} | ||
labels: | ||
app: ${NAME} | ||
component: ${NAME}-job | ||
parameters: | ||
- name: NAME | ||
value: sso-benchmark-runner | ||
- name: IMAGE_TAG | ||
value: dev | ||
- name: IMAGE_REPOSITORY | ||
value: ghcr.io/bcgov/sso-benchmark-runner | ||
- name: KEYCLOAK_BENCHMARK_VERSION | ||
value: keycloak-benchmark-0.15-SNAPSHOT | ||
- name: CONFIG | ||
description: Configuration set of parameters for the test |