Skip to content

Commit bca7f73

Browse files
committed
feat(deploy): added OpenShift4 deployment files
angular 8-rc2, Profile code pruning, hosted keycloak on OpenShift4
1 parent eff9ad5 commit bca7f73

File tree

31 files changed

+1627
-1005
lines changed

31 files changed

+1627
-1005
lines changed

.deploy/keycloak/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,12 @@ PROXY_ADDRESS_FORWARDING="true"
7474

7575
Refer https://stackoverflow.com/questions/53550321/keycloak-gatekeeper-aud-claim-and-client-id-do-not-match
7676

77-
1. add `ngxapi_audience` **Client Scopes** at Realm `ngx` with Audience mapper name: `ngxapi_audience_mapper`, Mapper Type --> `audience` and adding `ngxapi` Client under `Included Client Audience`.
78-
2. for `ngxweb` client, add `ngxapi_audience` at **Client Scopes** tab
79-
3. for `ngxapi` client, add `ngxapi_audience` at **Client Scopes** tab (for Swagger API Docs)
77+
1. add `ngxapi-audience` **Client Scopes** at Realm `ngx` with Audience mapper name: `ngxapi-audience-mapper`, Mapper Type --> `audience` and adding `ngxapi` Client under `Included Client Audience`.
78+
2. for `ngxweb` client, add `ngxapi-audience` at **Client Scopes** tab
79+
3. for `ngxapi` client, add `ngxapi-audience` at **Client Scopes** tab (for Swagger API Docs)
80+
81+
Refer https://www.kodnito.com/posts/microprofile-jwt-with-keycloak/
82+
4. Click on Clients and find the `ngxweb/ngxapi` and click on **Mappers** tab and click on **Add Builtin** button and add the **groups** mapper to the client.
8083

8184
---
8285

@@ -110,6 +113,15 @@ kubectl cp $POD_NAME:/tmp/sumo /Developer/Work/SPA/ngx-starter-kit/.deploy/keycl
110113
```
111114

112115
---
116+
## MicroProfile JWT with Keycloak
117+
118+
**how to secure API/services using MicroProfile JWT and Keycloak?**
119+
120+
Follow [blog](https://kodnito.com/posts/microprofile-jwt-with-keycloak/)
121+
You find the public key here https://keycloak.traefik.k8s/auth/realms/ngx/
122+
123+
---
124+
113125

114126
## Troubleshooting
115127

.deploy/keycloak/helm/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
Deploying `KeyCloak` to `Kubernetes` via `Helm`
44

5+
we will be using charts from [codecentric](https://github.com/codecentric/helm-charts) Repo.
6+
57
### With Tiller
68

79
```bash
810
cd .deploy/keycloak/helm
911

12+
# add KeyCloak Charts Repo
13+
helm repo add codecentric https://codecentric.github.io/helm-charts
14+
1015
# To install the chart with the release name `keycloak`
1116
# --dry-run --debug flags help you to see before you really deploy
12-
helm install --name=keycloak --namespace=default -f values-dev.yaml stable/keycloak
17+
helm install --name keycloak --namespace=default -f values-dev.yaml codecentric/keycloak
1318

1419
# verify deployment
1520
helm ls
@@ -25,7 +30,7 @@ echo | openssl s_client -showcerts -connect keycloak.traefik.k8s:443 2>/dev/null
2530

2631

2732
# To update
28-
helm upgrade --namespace=default -f values-dev.yaml keycloak stable/keycloak
33+
helm upgrade --namespace=default -f values-dev.yaml keycloak codecentric/keycloak
2934

3035
# To uninstall/delete the `keycloak` deployment
3136
helm delete keycloak
@@ -40,9 +45,9 @@ kubectl scale statefulset keycloak --replicas=0
4045
```bash
4146
cd .deploy/keycloak/helm
4247

43-
helm fetch stable/keycloak
48+
helm fetch codecentric/keycloak
4449

45-
helm template ./keycloak-4.7.0.tgz \
50+
helm template ./keycloak-4.11.1.tgz \
4651
--name keycloak \
4752
--namespace default \
4853
--values values-dev.yaml \

.deploy/keycloak/helm/values-dev.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ test:
22
enabled: false
33

44
keycloak:
5+
image:
6+
repository: jboss/keycloak
7+
tag: 6.0.1
58
username: admin
69
password: admin123
710
persistence:

.deploy/keycloak/helm/values-os.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
test:
2+
enabled: false
3+
4+
keycloak:
5+
image:
6+
repository: jboss/keycloak
7+
tag: 6.0.1
8+
username: admin
9+
password: species
10+
securityContext: {}
11+
resources:
12+
limits:
13+
memory: 1G
14+
requests:
15+
memory: 512M
16+
ingress:
17+
enabled: true
18+
hosts:
19+
- keycloak-ngx.apps.us-west-1.online-starter.openshift.com

.deploy/keycloak/helm/values-prod.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
resources:
22
limits:
33
cpu: 4
4-
memory: "4096Mi"
4+
memory: '4096Mi'
55
requests:
66
cpu: 2
7-
memory: "2048Mi"
7+
memory: '2048Mi'
88

99
livenessProbe:
1010
initialDelaySeconds: 200
@@ -19,6 +19,7 @@ test:
1919
keycloak:
2020
image:
2121
repository: jboss/keycloak
22+
tag: 6.0.1
2223
username: admin
2324
password: admin123
2425
persistence:

.deploy/keycloak/helm/values.yaml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ keycloak:
1111

1212
image:
1313
repository: jboss/keycloak
14-
tag: 5.0.0
14+
tag: 6.0.1
1515
pullPolicy: IfNotPresent
1616

1717
## Optionally specify an array of imagePullSecrets.
@@ -50,17 +50,17 @@ keycloak:
5050
# command: ["/bin/sh", "-c", "ls"]
5151
5252
## Additional arguments to start command e.g. -Dkeycloak.import= to load a realm
53-
extraArgs: ""
53+
extraArgs: ''
5454

5555
## Username for the initial Keycloak admin user
5656
username: keycloak
5757

5858
## Password for the initial Keycloak admin user. Applicable only if existingSecret is not set.
5959
## If not set, a random 10 characters password will be used
60-
password: ""
60+
password: ''
6161

6262
# Specifies an existing secret to be used for the admin password
63-
existingSecret: ""
63+
existingSecret: ''
6464

6565
# The key in the existing secret that stores the password
6666
existingSecretKey: password
@@ -108,7 +108,7 @@ keycloak:
108108
topologyKey: failure-domain.beta.kubernetes.io/zone
109109
110110
nodeSelector: {}
111-
priorityClassName: ""
111+
priorityClassName: ''
112112
tolerations: []
113113

114114
## Additional pod labels
@@ -125,7 +125,8 @@ keycloak:
125125
initialDelaySeconds: 30
126126
timeoutSeconds: 1
127127

128-
resources: {}
128+
resources:
129+
{}
129130
# limits:
130131
# cpu: "100m"
131132
# memory: "1024Mi"
@@ -161,7 +162,8 @@ keycloak:
161162
## Add additional ports, eg. for custom admin console
162163
extraPorts: |
163164
164-
podDisruptionBudget: {}
165+
podDisruptionBudget:
166+
{}
165167
# maxUnavailable: 1
166168
# minAvailable: 1
167169

@@ -190,11 +192,15 @@ keycloak:
190192
enabled: false
191193
path: /
192194

193-
annotations: {}
195+
annotations:
196+
{}
194197
# kubernetes.io/ingress.class: nginx
195198
# kubernetes.io/tls-acme: "true"
196199
# ingress.kubernetes.io/affinity: cookie
197200

201+
labels: {}
202+
# key: value
203+
198204
## List of hosts for the ingress
199205
hosts:
200206
- keycloak.example.com
@@ -216,7 +222,7 @@ keycloak:
216222
## The following values only apply if "deployPostgres" is set to "false"
217223

218224
# Specifies an existing secret to be used for the database password
219-
existingSecret: ""
225+
existingSecret: ''
220226

221227
# The key in the existing secret that stores the password
222228
existingSecretKey: password
@@ -227,7 +233,7 @@ keycloak:
227233
dbUser: keycloak
228234

229235
# Only used if no existing secret is specified. In this case a new secret is created
230-
dbPassword: ""
236+
dbPassword: ''
231237

232238
postgresql:
233239
### PostgreSQL User to create.
@@ -237,7 +243,7 @@ postgresql:
237243
## PostgreSQL Password for the new user.
238244
## If not set, a random 10 characters password will be used.
239245
##
240-
postgresPassword: ""
246+
postgresPassword: ''
241247

242248
## PostgreSQL Database to create.
243249
##

.deploy/keycloak/manual/04-keycloak-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
echo 'PostgreSQL OK ✓'
3232
containers:
3333
- name: keycloak
34-
image: jboss/keycloak:4.8.3.Final
34+
image: jboss/keycloak:6.0.1
3535
imagePullPolicy: IfNotPresent
3636
ports:
3737
- name: http

.deploy/keycloak/openshift/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
# Postgres on OpenShift
2-
3-
Deploying `Postgres` to `OpenShift` via `Helm`
4-
5-
### Deploying to OpenShift
1+
### KeyCloak on OpenShift
62

73
> Deploy KeyCloak to OpenShift
84

.deploy/keycloak/openshift/keycloak-openshift.yaml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,6 @@ items:
101101
name: keycloak-secrets
102102
- configMapRef:
103103
name: keycloak-config
104-
# env:
105-
# - name: POD_NAMESPACE
106-
# valueFrom:
107-
# fieldRef:
108-
# apiVersion: v1
109-
# fieldPath: metadata.namespace
110-
# - name: PROXY_ADDRESS_FORWARDING
111-
# value: "true"
112-
# - name: KEYCLOAK_USER
113-
# valueFrom:
114-
# configMapKeyRef:
115-
# name: keycloak-config
116-
# key: KEYCLOAK_USER
117-
# - name: KEYCLOAK_PASSWORD
118-
# valueFrom:
119-
# secretKeyRef:
120-
# name: keycloak-secrets
121-
# key: KEYCLOAK_PASSWORD
122104
livenessProbe:
123105
httpGet:
124106
path: /auth/realms/master

.deploy/keycloak/openshift4/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### KeyCloak on OpenShift 4.1
2+
3+
> Deploy KeyCloak to OpenShift
4+
5+
All files here are generated with Helm:
6+
7+
```bash
8+
cd .deploy/keycloak/helm
9+
10+
helm fetch codecentric/keycloak
11+
helm template ./keycloak-4.11.1.tgz --name keycloak --namespace default --values values-os.yaml --output-dir generated
12+
```
13+
14+
After generation, remove `securityContext` block from `statefulset.yaml`

0 commit comments

Comments
 (0)