Skip to content

Commit

Permalink
[keycloak] Expose keycloak generated dns name as env variable (#6… (#69)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
thomasdarimont authored and unguiculus committed Jul 10, 2019
1 parent 7dd21ca commit d939a46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/keycloak/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: keycloak
version: 5.0.1
version: 5.1.0
appVersion: 6.0.1
description: Open Source Identity and Access Management For Modern Applications and Services
keywords:
Expand Down
7 changes: 7 additions & 0 deletions charts/keycloak/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ We truncate to 20 characters because this is used to set the node identifier in
{{- end -}}
{{- end -}}

{{/*
Create the service DNS name.
*/}}
{{- define "keycloak.serviceDnsName" -}}
{{ include "keycloak.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
Expand Down
4 changes: 3 additions & 1 deletion charts/keycloak/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ spec:
- name: JGROUPS_DISCOVERY_PROTOCOL
value: "dns.DNS_PING"
- name: JGROUPS_DISCOVERY_PROPERTIES
value: "dns_query={{ include "keycloak.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
value: "dns_query={{ include "keycloak.serviceDnsName" . }}"
- name: KEYCLOAK_SERVICE_DNS_NAME
value: "{{ include "keycloak.serviceDnsName" . }}"
{{- end }}
{{- include "keycloak.dbEnvVars" . | nindent 12 }}
{{- with .Values.keycloak.extraEnv }}
Expand Down

0 comments on commit d939a46

Please sign in to comment.