Skip to content

Keycloak - Create deployment #16

Keycloak - Create deployment

Keycloak - Create deployment #16

name: Keycloak - Create deployment
on:
workflow_dispatch:
inputs:
clusterName:
description: 'Name of the cluster'
type: string
replicas:
description: 'Number of keycloak pods'
disableStickySessions:
description: 'Disable sticky sessions in OpenShift Route'
type: boolean
default: false
required: true
image:
description: 'Keycloak Image'
type: string
podMemoryRequests:
description: 'Keycloak pod memory requests (in MB)'
type: string
podMemoryLimit:
description: 'Keycloak pod memory limit (in MB)'
type: string
podCpuRequests:
description: 'Keycloak pod CPU requests'
type: string
podCpuLimit:
description: 'Keycloak pod CPU limit'
type: string
heapMaxSizeMB:
description: 'Keycloak server maximum Java heap size (in MB)'
type: string
# Hack to workaround the max limit of 10 inputes
additional_args:
description: JSON of additional options
type: string
default: '{}'
required: false
env:
PROJECT_PREFIX: runner- # same as default
PROJECT: runner-keycloak
jobs:
prepare:
name: Create Keycloak deployment
runs-on: ubuntu-latest
env:
AURORA_CLUSTER: ${{ fromJson(inputs.additional_args).auroraDb }}
AURORA_REGION: ${{ fromJson(inputs.additional_args).auroraRegion }}
KC_HOSTNAME_OVERRIDE: ${{ fromJson(inputs.additional_args).kcHostnameOverride }}
KC_HEALTH_HOSTNAME: ${{ fromJson(inputs.additional_args).kcHealthHostname }}
CLUSTER_NAME: ${{ inputs.clusterName || format('gh-{0}', github.repository_owner) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup ROSA CLI
uses: ./.github/actions/rosa-cli-setup
with:
aws-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-default-region: ${{ vars.AWS_DEFAULT_REGION }}
rosa-token: ${{ secrets.ROSA_TOKEN }}
- name: Login to OpenShift cluster
uses: ./.github/actions/oc-keycloak-login
with:
clusterName: ${{ env.CLUSTER_NAME }}
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- if: ${{ env.AURORA_CLUSTER != '' }}
name: Aurora Peering Connection
uses: ./.github/actions/aurora-create-peering-connection
with:
name: ${{ env.AURORA_CLUSTER }}
region: ${{ env.AURORA_REGION }}
clusterName: ${{ env.CLUSTER_NAME }}
- if: ${{ env.AURORA_CLUSTER != '' }}
name: Aurora URL
run: |
echo "AURORA_URL=$(./provision/aws/rds/aurora_endpoint.sh)" >> $GITHUB_ENV
echo "DATABASE=aurora-postgres" >> $GITHUB_ENV
- name: Create Keycloak deployment
uses: ./.github/actions/keycloak-create-deployment
with:
projectPrefix: ${{ env.PROJECT_PREFIX }}
replicas: ${{ inputs.replicas }}
disableStickySessions: ${{ inputs.disableStickySessions }}
image: ${{ inputs.image }}
podMemoryRequests: ${{ inputs.podMemoryRequests }}
podMemoryLimit: ${{ inputs.podMemoryLimit }}
podCpuRequests: ${{ inputs.podCpuRequests }}
podCpuLimit: ${{ inputs.podCpuLimit }}
heapMaxSizeMB: ${{ inputs.heapMaxSizeMB }}
database: ${{ env.DATABASE }}
databaseUrl: ${{ env.AURORA_URL }}
kcHostnameOverride: ${{ env.KC_HOSTNAME_OVERRIDE }}
kcHealthHostname: ${{ env.KC_HEALTH_HOSTNAME }}