Skip to content

Commit 0237457

Browse files
rob-64Rob Theriault
andauthored
[keycloak] Allow keycloak to have a relative path (CloudPirates-io#216)
* all keycloak to have a relative path * bump chart version * Updated readme * updated values schema --------- Co-authored-by: Rob Theriault <[email protected]>
1 parent 8a4003f commit 0237457

File tree

7 files changed

+41
-4
lines changed

7 files changed

+41
-4
lines changed

charts/keycloak/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: keycloak
33
description: Open Source Identity and Access Management Solution
44
type: application
5-
version: 0.1.10
5+
version: 0.1.11
66
appVersion: "26.3.4"
77
keywords:
88
- keycloak

charts/keycloak/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ The following table lists the configurable parameters of the Keycloak chart and
130130
| `keycloak.proxyProtocolEnabled` | Whether the server should use the HA PROXY protocol when serving requests from behind a proxy. (true, false) | `false` |
131131
| `keycloak.proxyTrustedAddresses` | A comma separated list of trusted proxy addresses | `""` |
132132
| `keycloak.production` | Enable production mode | `false` |
133+
| `keycloak.httpRelativePath` | Set relative path for serving resources; must start with a / | `""` |
133134

134135
### Database Configuration
135136

charts/keycloak/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,15 @@ Return the database JDBC URL
180180
{{- printf "jdbc:mysql://%s:%s/%s%s" .Values.database.host (default "3306" (.Values.database.port | toString)) .Values.database.name (ternary (printf "?%s" .Values.database.jdbcParams) "" (ne .Values.database.jdbcParams "")) -}}
181181
{{- end -}}
182182
{{- end -}}
183+
{{- end }}
184+
185+
{{/*
186+
Return the url to use for probes
187+
*/}}
188+
{{- define "keycloak.probeUrl" -}}
189+
{{- if or (eq .Values.keycloak.httpRelativePath "") (eq .Values.keycloak.httpRelativePath "/") -}}
190+
{{- printf "/realms/master" -}}
191+
{{- else -}}
192+
{{- printf "%s/realms/master" .Values.keycloak.httpRelativePath -}}
193+
{{- end -}}
183194
{{- end }}

charts/keycloak/templates/deployment.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ spec:
108108
- --features-disabled={{ join "," .Values.features.disabled }}
109109
{{- end }}
110110
env:
111+
- name: KC_HTTP_RELATIVE_PATH
112+
value: {{ .Values.keycloak.httpRelativePath | quote | default "/" }}
111113
- name: KC_BOOTSTRAP_ADMIN_USERNAME
112114
value: {{ .Values.keycloak.adminUser | quote }}
113115
- name: KC_BOOTSTRAP_ADMIN_PASSWORD
@@ -166,7 +168,7 @@ spec:
166168
{{- if .Values.livenessProbe.enabled }}
167169
livenessProbe:
168170
httpGet:
169-
path: /realms/master
171+
path: {{ include "keycloak.probeUrl" . }}
170172
port: http
171173
scheme: HTTP
172174
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
@@ -178,7 +180,7 @@ spec:
178180
{{- if .Values.readinessProbe.enabled }}
179181
readinessProbe:
180182
httpGet:
181-
path: /realms/master
183+
path: {{ include "keycloak.probeUrl" . }}
182184
port: http
183185
scheme: HTTP
184186
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
@@ -190,7 +192,7 @@ spec:
190192
{{- if .Values.startupProbe.enabled }}
191193
startupProbe:
192194
httpGet:
193-
path: /realms/master
195+
path: {{ include "keycloak.probeUrl" . }}
194196
port: http
195197
scheme: HTTP
196198
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
suite: test service account
2+
templates:
3+
- templates/deployment.yaml
4+
tests:
5+
- it: readiness probe should be original
6+
asserts:
7+
- equal:
8+
path: spec.template.spec.containers[0].readinessProbe.httpGet.path
9+
value: /realms/master
10+
- it: readiness probe should include the httpRelativePath
11+
set:
12+
keycloak:
13+
httpRelativePath: /auth
14+
asserts:
15+
- equal:
16+
path: spec.template.spec.containers[0].readinessProbe.httpGet.path
17+
value: /auth/realms/master

charts/keycloak/values.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@
191191
"production": {
192192
"type": "boolean",
193193
"description": "Enable production mode"
194+
},
195+
"httpRelativePath": {
196+
"type": "string",
197+
"description": "Set relative path for serving resources; must start with a /"
194198
}
195199
}
196200
},

charts/keycloak/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ keycloak:
9292
proxyTrustedAddresses: ""
9393
## @param keycloak.production Enable production mode
9494
production: false
95+
## @param keycloak.httpRelativePath Set relative path for serving resources; must start with a /
96+
httpRelativePath: ""
9597

9698
## @section Database Configuration
9799
database:

0 commit comments

Comments
 (0)