Skip to content

Commit

Permalink
[keycloak] Add service account creation (#26)
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Effing <[email protected]>
  • Loading branch information
denniseffing authored and unguiculus committed May 15, 2019
1 parent 9e530e4 commit efc33c3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 1 deletion.
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: 4.13.2
version: 4.14.0
appVersion: 5.0.0
description: Open Source Identity and Access Management For Modern Applications and Services
keywords:
Expand Down
1 change: 1 addition & 0 deletions charts/keycloak/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Parameter | Description | Default
`keycloak.podAnnotations` | Extra annotations to add to pod | `{}`
`keycloak.hostAliases` | Mapping between IP and hostnames that will be injected as entries in the pod's hosts files | `[]`
`keycloak.enableServiceLinks` | Indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links | `false`
`keycloak.serviceAccount.create` | If `true`, a new service account is created | `false`
`keycloak.securityContext` | Security context for the entire pod. Every container running in the pod will inherit this security context. This might be relevant when other components of the environment inject additional containers into running pods (service meshs are the most prominent example for this) | `{fsGroup: 1000}`
`keycloak.containerSecurityContext` | Security context for containers running in the pod. Will not be inherited by additionally injected containers | `{runAsUser: 1000, runAsNonRoot: true}`
`keycloak.preStartScript` | Custom script to run before Keycloak starts up | ``
Expand Down
11 changes: 11 additions & 0 deletions charts/keycloak/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create name of the service account to use
*/}}
{{- define "keycloak.serviceAccountName" -}}
{{- if .Values.keycloak.serviceAccount.create -}}
{{ default (include "keycloak.fullname" .) .Values.keycloak.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.keycloak.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified app name for the postgres requirement.
*/}}
Expand Down
11 changes: 11 additions & 0 deletions charts/keycloak/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.keycloak.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "keycloak.name" . }}
chart: {{ template "keycloak.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "keycloak.fullname" . }}
{{- end -}}
1 change: 1 addition & 0 deletions charts/keycloak/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
{{ toYaml . | indent 8 }}
{{- end }}
enableServiceLinks: {{ .Values.keycloak.enableServiceLinks }}
serviceAccountName: {{ template "keycloak.serviceAccountName" . }}
securityContext:
{{ toYaml .Values.keycloak.securityContext | indent 8 }}
{{- with .Values.keycloak.image.pullSecrets }}
Expand Down
7 changes: 7 additions & 0 deletions charts/keycloak/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ keycloak:

enableServiceLinks: false

serviceAccount:
# Specifies whether a service account should be created
create: false
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name:

securityContext:
fsGroup: 1000

Expand Down

0 comments on commit efc33c3

Please sign in to comment.