Skip to content

Commit d939a46

Browse files
thomasdarimontunguiculus
authored andcommitted
[keycloak] Expose keycloak generated dns name as env variable (#6… (#69)
We now expose the generated DNS name of the Keycloak headless-service via the environment variable KEYCLOAK_SERVICE_DNS_NAME. This eases the usage of custom jgroups configurations in custom Keycloak images. In order to avoid code duplication we introduced a new template function called `serviceDnsName` accessible via `keycloak.serviceDnsName`. Signed-off-by: Thomas Darimont <[email protected]>
1 parent 7dd21ca commit d939a46

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

charts/keycloak/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: keycloak
2-
version: 5.0.1
2+
version: 5.1.0
33
appVersion: 6.0.1
44
description: Open Source Identity and Access Management For Modern Applications and Services
55
keywords:

charts/keycloak/templates/_helpers.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ We truncate to 20 characters because this is used to set the node identifier in
2424
{{- end -}}
2525
{{- end -}}
2626

27+
{{/*
28+
Create the service DNS name.
29+
*/}}
30+
{{- define "keycloak.serviceDnsName" -}}
31+
{{ include "keycloak.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
32+
{{- end -}}
33+
2734
{{/*
2835
Create chart name and version as used by the chart label.
2936
*/}}

charts/keycloak/templates/statefulset.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ spec:
9090
- name: JGROUPS_DISCOVERY_PROTOCOL
9191
value: "dns.DNS_PING"
9292
- name: JGROUPS_DISCOVERY_PROPERTIES
93-
value: "dns_query={{ include "keycloak.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
93+
value: "dns_query={{ include "keycloak.serviceDnsName" . }}"
94+
- name: KEYCLOAK_SERVICE_DNS_NAME
95+
value: "{{ include "keycloak.serviceDnsName" . }}"
9496
{{- end }}
9597
{{- include "keycloak.dbEnvVars" . | nindent 12 }}
9698
{{- with .Values.keycloak.extraEnv }}

0 commit comments

Comments
 (0)