-
Notifications
You must be signed in to change notification settings - Fork 77
108 lines (99 loc) · 3.67 KB
/
keycloak-create-deployment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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 }}