This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
/
statefulset.yaml
117 lines (116 loc) · 3.9 KB
/
statefulset.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: {{ template "keycloak.fullname" . }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
labels:
app: {{ template "keycloak.name" . }}
chart: {{ template "keycloak.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: {{ .Values.keycloak.replicas }}
serviceName: {{ template "keycloak.fullname" . }}-headless
podManagementPolicy: Parallel
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: {{ template "keycloak.name" . }}
release: "{{ .Release.Name }}"
spec:
securityContext:
{{ toYaml .Values.keycloak.securityContext | indent 8 }}
{{- with .Values.keycloak.image.pullSecrets }}
imagePullSecrets:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if or .Values.keycloak.persistence.deployPostgres .Values.keycloak.extraInitContainers }}
initContainers:
{{- if .Values.keycloak.persistence.deployPostgres }}
- name: wait-for-postgresql
image: "{{ .Values.init.image.repository }}:{{ .Values.init.image.tag }}"
imagePullPolicy: {{ .Values.init.image.pullPolicy }}
command:
- sh
- -c
- |
until printf "." && nc -z -w 2 {{ template "keycloak.postgresql.fullname" . }} {{ .Values.postgresql.service.port }}; do
sleep 2;
done;
echo 'PostgreSQL OK ✓'
{{- end }}
{{- if .Values.keycloak.extraInitContainers }}
{{ tpl .Values.keycloak.extraInitContainers . | indent 8 }}
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.keycloak.image.repository }}:{{ .Values.keycloak.image.tag }}"
imagePullPolicy: {{ .Values.keycloak.image.pullPolicy }}
command:
- /scripts/keycloak.sh
env:
{{- if .Release.IsInstall }}
- name: KEYCLOAK_USER
value: {{ .Values.keycloak.username }}
- name: KEYCLOAK_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "keycloak.fullname" . }}-http
key: password
{{- end }}
{{ include "keycloak.dbEnvVars" . | indent 12 }}
{{- with .Values.keycloak.extraEnv }}
{{ tpl . $ | indent 12 }}
{{- end }}
volumeMounts:
- name: scripts
mountPath: /scripts
{{- with .Values.keycloak.extraVolumeMounts }}
{{ tpl . $ | indent 12 }}
{{- end }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /auth/
port: http
initialDelaySeconds: {{ .Values.keycloak.livenessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.keycloak.livenessProbe.timeoutSeconds }}
readinessProbe:
httpGet:
path: /auth/
port: http
initialDelaySeconds: {{ .Values.keycloak.readinessProbe.initialDelaySeconds }}
timeoutSeconds: {{ .Values.keycloak.readinessProbe.timeoutSeconds }}
resources:
{{ toYaml .Values.keycloak.resources | indent 12 }}
{{- with .Values.keycloak.extraContainers }}
{{ tpl . $ | indent 8 }}
{{- end }}
{{- with .Values.keycloak.affinity }}
affinity:
{{ tpl . $ | indent 8 }}
{{- end }}
{{- with .Values.keycloak.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.keycloak.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
terminationGracePeriodSeconds: 60
volumes:
- name: scripts
configMap:
name: {{ template "keycloak.fullname" . }}
defaultMode: 0555
{{- with .Values.keycloak.extraVolumes }}
{{ tpl . $ | indent 8 }}
{{- end }}