Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit 3786546

Browse files
committed
feat: #117 UPdating Keycloak, Postgres and MongoDB to latest possible versions
Signed-off-by: Laurent Broudoux <laurent.broudoux@gmail.com>
1 parent ab9f2b5 commit 3786546

File tree

7 files changed

+62
-25
lines changed

7 files changed

+62
-25
lines changed

k8s/keycloak-config.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,5 +204,16 @@ data:
204204
],
205205
"identityProviders": [
206206
],
207+
"requiredActions": [
208+
{
209+
"alias": "VERIFY_PROFILE",
210+
"name": "Verify Profile",
211+
"providerId": "VERIFY_PROFILE",
212+
"enabled": false,
213+
"defaultAction": false,
214+
"priority": 90,
215+
"config": {}
216+
}
217+
],
207218
"keycloakVersion": "10.0.1"
208219
}

k8s/keycloak-postgres-deployment.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,11 @@ spec:
3232
container: keycloak-postgresql
3333
group: microcks
3434
spec:
35-
{% if 'route.openshift.io' not in api_groups -%}
36-
securityContext:
37-
runAsUser: 26
38-
runAsGroup: 26
39-
fsGroup: 26
40-
{% endif -%}
4135
terminationGracePeriodSeconds: 60
4236
containers:
4337
- name: keycloak-postgresql
4438
image: {{keycloak.postgres_image}}
39+
args: ["-c", "max_connections=100", "-c", "shared_buffers=12MB"]
4540
imagePullPolicy: IfNotPresent
4641
ports:
4742
- containerPort: 5432
@@ -54,30 +49,25 @@ spec:
5449
- "/bin/sh"
5550
- "-i"
5651
- "-c"
57-
- psql 127.0.0.1 -U ${POSTGRESQL_USER} -q -d ${POSTGRESQL_DATABASE}
58-
-c 'SELECT 1'
52+
- psql 127.0.0.1 -U ${POSTGRES_USER} -q -d ${POSTGRES_DB} -c 'SELECT 1'
5953
livenessProbe:
6054
timeoutSeconds: 1
6155
initialDelaySeconds: 30
6256
tcpSocket:
6357
port: 5432
6458
env:
65-
- name: POSTGRESQL_USER
59+
- name: POSTGRES_USER
6660
valueFrom:
6761
secretKeyRef:
6862
key: postgresUsername
6963
name: "{{name}}-keycloak-admin"
70-
- name: POSTGRESQL_PASSWORD
64+
- name: POSTGRES_PASSWORD
7165
valueFrom:
7266
secretKeyRef:
7367
key: postgresPassword
7468
name: "{{name}}-keycloak-admin"
75-
- name: POSTGRESQL_DATABASE
69+
- name: POSTGRES_DB
7670
value: root
77-
- name: POSTGRESQL_MAX_CONNECTIONS
78-
value: '100'
79-
- name: POSTGRESQL_SHARED_BUFFERS
80-
value: 12MB
8171
volumeMounts:
8272
- name: "{{name}}-keycloak-postgresql-data"
8373
mountPath: "/var/lib/pgsql/data"

k8s/mongodb-config.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
kind: ConfigMap
2+
apiVersion: v1
3+
metadata:
4+
name: "{{name}}-mongodb-init"
5+
namespace: '{{ meta.namespace }}'
6+
labels:
7+
app: "{{name}}"
8+
container: mongodb
9+
group: microcks
10+
data:
11+
create-user.sh: |-
12+
#!/bin/bash
13+
echo "Started Adding the Users..."
14+
mongo admin --eval "db.getSiblingDB('${MONGO_INITDB_DATABASE}').createUser({user: '${MONGODB_USER}', pwd: '${MONGODB_PASSWORD}', roles: [{role: 'readWrite', db: '${MONGO_INITDB_DATABASE}'}]})"
15+
echo "End Adding the User Roles."

k8s/mongodb-deployment.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ spec:
4242
containers:
4343
- name: mongodb
4444
image: {{mongodb.image}}
45+
args: ["--dbpath","/var/lib/mongodb/data"]
4546
ports:
4647
- containerPort: 27017
4748
protocol: TCP
@@ -56,12 +57,17 @@ spec:
5657
secretKeyRef:
5758
key: password
5859
name: "{{name}}-mongodb-connection"
59-
- name: MONGODB_ADMIN_PASSWORD
60+
- name: MONGO_INITDB_ROOT_USERNAME
61+
valueFrom:
62+
secretKeyRef:
63+
key: adminUsername
64+
name: "{{name}}-mongodb-connection"
65+
- name: MONGO_INITDB_ROOT_PASSWORD
6066
valueFrom:
6167
secretKeyRef:
6268
key: adminPassword
6369
name: "{{name}}-mongodb-connection"
64-
- name: MONGODB_DATABASE
70+
- name: MONGO_INITDB_DATABASE
6571
value: "{{name}}"
6672
resources:
6773
{{ mongodb.resources | to_nice_yaml(indent=10) | trim | indent(10) }}
@@ -73,7 +79,7 @@ spec:
7379
- "/bin/sh"
7480
- "-i"
7581
- "-c"
76-
- mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD
82+
- mongo 127.0.0.1:27017/$MONGO_INITDB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD
7783
--eval="quit()"
7884
livenessProbe:
7985
timeoutSeconds: 1
@@ -83,6 +89,8 @@ spec:
8389
volumeMounts:
8490
- name: "{{name}}-mongodb-data"
8591
mountPath: "/var/lib/mongodb/data"
92+
- name: custom-init-scripts
93+
mountPath: /docker-entrypoint-initdb.d
8694
terminationMessagePath: "/dev/termination-log"
8795
imagePullPolicy: IfNotPresent
8896
securityContext:
@@ -96,4 +104,8 @@ spec:
96104
claimName: "{{name}}-mongodb"
97105
{% else %}emptyDir:
98106
medium: ''
99-
{% endif %}
107+
{% endif %}
108+
109+
- name: custom-init-scripts
110+
configMap:
111+
name: "{{name}}-mongodb-init"

k8s/mongodb-secret.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ stringData:
1212
{% if 'username' in mongodb %}username: '{{mongodb.username}}'
1313
{% else %}username: user{{ lookup('password', '/dev/null length=5 chars=ascii_letters') }}
1414
{% endif %}
15+
1516
data:
1617
{% if 'password' in mongodb %}password: {{ mongodb.password | b64encode | quote }}
17-
{% else %}password: {{ lookup('password', '/dev/null length=32 chars=ascii_letters') | b64encode | quote }}
18+
{% else %}password: {{ lookup('password', '/dev/null length=32 chars=ascii_letters') | b64encode | quote }}
19+
{% endif %}{% if 'adminUsername' in mongodb %}adminUsername: {{ mongodb.adminUsername | b64encode | quote }}
20+
{% else %}adminUsername: {{ lookup('password', '/dev/null length=16 chars=ascii_letters') | b64encode | quote }}
1821
{% endif %}{% if 'adminPassword' in mongodb %}adminPassword: {{ mongodb.adminPassword | b64encode | quote }}
19-
{% else %}adminPassword: {{ lookup('password', '/dev/null length=32 chars=ascii_letters') | b64encode | quote }}
22+
{% else %}adminPassword: {{ lookup('password', '/dev/null length=32 chars=ascii_letters') | b64encode | quote }}
2023
{% endif %}

roles/microcks/defaults/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# defaults specification file for microcks installation
33
name: microcks
4-
version: 1.7.0
4+
version: 1.9.1
55
microcks:
66
replicas: 1
77
#url: microcks.192.168.99.100.nip.io
@@ -56,7 +56,7 @@ postman:
5656
keycloak:
5757
install: true
5858
realm: microcks
59-
image: keycloak/keycloak:22.0.3
59+
image: keycloak/keycloak:24.0.4
6060
# Now that we switched to newer version of Keycloak-X, url must include the
6161
# '/auth' path if you use an older external Keycloak instance.
6262
#url: keycloak.192.168.99.100.nip.io
@@ -81,7 +81,7 @@ keycloak:
8181
persistent: true
8282
volume_size: 1Gi
8383
#storage_class_name: my-awesome-class
84-
postgres_image: centos/postgresql-95-centos7:latest
84+
postgres_image: library/postgres:16.3-alpine
8585
openshift:
8686
route:
8787
enabled: true
@@ -111,7 +111,7 @@ mongodb:
111111
persistent: true
112112
volume_size: 2Gi
113113
#storage_class_name: my-awesome-class
114-
image: centos/mongodb-36-centos7:latest
114+
image: library/mongo:4.4.29
115115
resources:
116116
#requests:
117117
#cpu: 250m

roles/microcks/tasks/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
force: False
4242
definition: "{{ lookup('template', 'mongodb-pvc.yml') | from_yaml }}"
4343

44+
- name: The MongoDB ConfigMap is present if mongodb.install == true
45+
when: mongodb.install|bool
46+
k8s:
47+
state: "{{ 'present' if mongodb.install|bool else 'absent' }}"
48+
definition: "{{ lookup('template', 'mongodb-config.yml') | from_yaml }}"
49+
4450
- name: The MongoDB Deployment is present if mongodb.install == true
4551
when: mongodb.install|bool
4652
k8s:

0 commit comments

Comments
 (0)