forked from Enapter/charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsts.yaml
More file actions
314 lines (314 loc) · 11.4 KB
/
Copy pathsts.yaml
File metadata and controls
314 lines (314 loc) · 11.4 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "keydb.fullname" . }}
{{- if .Values.annotations }}
annotations:
{{- toYaml .Values.annotations | nindent 4 }}
{{- end }}
labels:
{{- include "keydb.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.nodes }}
serviceName: {{ include "keydb.fullname" . }}-headless
selector:
matchLabels:
{{- include "keydb.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/secret-utils: {{ include (print $.Template.BasePath "/secret-utils.yaml") . | sha256sum }}
{{- if .Values.exporter.enabled }}
prometheus.io/scrape: "true"
prometheus.io/path: "{{ .Values.exporter.scrapePath }}"
prometheus.io/port: "{{ .Values.exporter.port }}"
{{- end }}
{{- if .Values.podAnnotations }}
{{- toYaml .Values.podAnnotations | nindent 8 }}
{{- end }}
labels:
{{- include "keydb.labels" . | nindent 8 }}
spec:
affinity:
{{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
{{- if .Values.extraInitContainers }}
initContainers:
{{- toYaml .Values.extraInitContainers | nindent 6 }}
{{- end }}
containers:
- name: keydb
{{- if .Values.image }}
image: {{ .Values.image }}
{{- else }}
image: {{ .Values.imageRepository }}:{{ .Values.imageTag }}
{{- end }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
command:
- /utils/server.sh
env:
- name: REDIS_PORT
value: {{ .Values.internalPort | quote }}
{{- if .Values.existingSecret }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.existingSecret }}
key: {{ .Values.existingSecretPasswordKey }}
{{- else if .Values.password }}
- name: REDIS_PASSWORD
value: "{{ .Values.password }}"
{{- end }}
ports:
- name: {{ .Values.internalPortName }}
containerPort: {{ .Values.internalPort | int }}
protocol: TCP
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
{{- if .Values.livenessProbe.custom }}
{{- toYaml .Values.livenessProbe.custom | nindent 10 }}
{{- else }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
# One second longer than command timeout should prevent generation of zombie processes.
timeoutSeconds: {{ add1 .Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
exec:
command:
- sh
- -c
- /health/ping_liveness_local.sh {{ .Values.livenessProbe.timeoutSeconds }}
{{- end }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
{{- if .Values.readinessProbe.custom }}
{{- toYaml .Values.readinessProbe.custom | nindent 10 }}
{{- else }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
# One second longer than command timeout should prevent generation of zombie processes.
timeoutSeconds: {{ add1 .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
exec:
command:
- sh
- -c
- /health/ping_readiness_local.sh {{ .Values.readinessProbe.timeoutSeconds }}
{{- end }}
{{- end }}
{{- if .Values.startupProbe.enabled }}
startupProbe:
{{- if .Values.startupProbe.custom }}
{{- toYaml .Values.startupProbe.custom | nindent 10 }}
{{- else }}
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
# One second longer than command timeout should prevent generation of zombie processes.
timeoutSeconds: {{ add1 .Values.startupProbe.timeoutSeconds }}
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
exec:
command:
- sh
- -c
- /health/ping_readiness_local.sh {{ .Values.startupProbe.timeoutSeconds }}
{{- end }}
{{- end }}
{{- if .Values.lifecycle }}
lifecycle:
{{- toYaml .Values.lifecycle | nindent 10 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 10 }}
securityContext:
{{- toYaml .Values.keydb.securityContext | nindent 10 }}
volumeMounts:
- name: health
mountPath: /health
- name: keydb-data
mountPath: /data
- name: utils
mountPath: /utils
readOnly: true
{{- if .Values.extraVolumeMounts }}
{{- toYaml .Values.extraVolumeMounts | nindent 8 }}
{{- end }}
{{- if .Values.exporter.enabled }}
- name: redis-exporter
{{- if .Values.exporter.image }}
image: {{ .Values.exporter.image }}
{{- else }}
image: {{ .Values.exporter.imageRepository }}:{{ .Values.exporter.imageTag }}
{{- end }}
imagePullPolicy: {{ .Values.exporter.pullPolicy }}
args:
{{- range $item := .Values.exporter.extraArgs }}
{{- range $key, $value := $item }}
{{- if kindIs "invalid" $value }}
- --{{ $key }}
{{- else if kindIs "slice" $value }}
- --{{ $key }}
{{- range $value }}
- {{ . | quote }}
{{- end }}
{{- else }}
- --{{ $key }}
- {{ $value | quote }}
{{- end }}
{{- end }}
{{- end }}
env:
- name: REDIS_EXPORTER_WEB_LISTEN_ADDRESS
value: "0.0.0.0:{{ .Values.exporter.port }}"
- name: REDIS_EXPORTER_WEB_TELEMETRY_PATH
value: {{ .Values.exporter.scrapePath | quote }}
- name: REDIS_ADDR
value: "redis://localhost:{{ .Values.internalPort }}"
{{- if .Values.existingSecret }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.existingSecret }}
key: {{ .Values.existingSecretPasswordKey }}
{{- else if .Values.password }}
- name: REDIS_PASSWORD
value: "{{ .Values.password }}"
{{- end }}
{{- if .Values.exporter.livenessProbe }}
livenessProbe:
{{- toYaml .Values.exporter.livenessProbe | nindent 10 }}
{{- end }}
{{- if .Values.exporter.readinessProbe }}
readinessProbe:
{{- toYaml .Values.exporter.readinessProbe | nindent 10 }}
{{- end }}
{{- if .Values.exporter.startupProbe }}
startupProbe:
{{- toYaml .Values.exporter.startupProbe | nindent 10 }}
{{- end }}
resources:
{{- toYaml .Values.exporter.resources | nindent 10 }}
securityContext:
{{- toYaml .Values.exporter.securityContext | nindent 10 }}
ports:
- name: {{ .Values.exporter.portName | quote }}
containerPort: {{ .Values.exporter.port }}
protocol: TCP
{{- end }}
{{- if .Values.scripts.enabled }}
- name: scripts
{{- if .Values.image }}
image: {{ .Values.image }}
{{- else }}
image: {{ .Values.imageRepository }}:{{ .Values.imageTag }}
{{- end }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
command:
- /health/scripts_local.sh
env:
- name: REDIS_PORT
value: {{ .Values.internalPort | quote }}
{{- if .Values.existingSecret }}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.existingSecret }}
key: {{ .Values.existingSecretPasswordKey }}
{{- else if .Values.password }}
- name: REDIS_PASSWORD
value: "{{ .Values.password }}"
{{- end }}
resources:
{{- toYaml .Values.scripts.resources | nindent 10 }}
securityContext:
{{- toYaml .Values.scripts.securityContext | nindent 10 }}
volumeMounts:
- name: health
mountPath: /health
- name: keydb-data
mountPath: /data
{{- end }}
{{- if .Values.extraContainers }}
{{- toYaml .Values.extraContainers | nindent 6 }}
{{- end }}
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ include "keydb.serviceAccountName" . | quote }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{- toYaml .Values.tolerations | nindent 8 }}
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{- toYaml .Values.nodeSelector | nindent 8 }}
{{- end }}
{{- if .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range .Values.topologySpreadConstraints }}
- labelSelector:
matchLabels:
{{- include "keydb.selectorLabels" $ | nindent 14 }}
topologyKey: {{ default "topology.kubernetes.io/zone" .topologyKey }}
maxSkew: {{ .maxSkew }}
{{- if .minDomains }}
minDomains: {{ .minDomains }}
{{- end }}
whenUnsatisfiable: {{ default "DoNotSchedule" .whenUnsatisfiable }}
{{- if .nodeAffinityPolicy }}
nodeAffinityPolicy: {{ .nodeAffinityPolicy }}
{{- end }}
{{- if .nodeTaintsPolicy }}
nodeTaintsPolicy: {{ .nodeTaintsPolicy }}
{{- end }}
{{- end }}
{{- end }}
volumes:
- name: health
configMap:
name: {{ include "keydb.fullname" . }}-health
defaultMode: 0755
- name: utils
secret:
secretName: {{ include "keydb.fullname" . }}-utils
defaultMode: 0755
items:
- key: server.sh
path: server.sh
{{- if not .Values.persistentVolume.enabled }}
- name: keydb-data
emptyDir: {{- toYaml .Values.persistentVolume.emptyDir | nindent 10 }}
{{- end }}
{{- if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 6 }}
{{- end }}
{{- if .Values.persistentVolume.enabled }}
volumeClaimTemplates:
- metadata:
name: keydb-data
annotations:
{{- if .Values.persistentVolume.annotations }}
{{- toYaml .Values.persistentVolume.annotations | nindent 8 }}
{{- end }}
labels:
spec:
accessModes:
{{- toYaml .Values.persistentVolume.accessModes | nindent 8 }}
resources:
requests:
storage: {{ .Values.persistentVolume.size }}
{{- if .Values.persistentVolume.storageClass }}
{{- if (eq "-" .Values.persistentVolume.storageClass) }}
storageClassName: ""
{{ else }}
storageClassName: {{ .Values.persistentVolume.storageClass }}
{{- end }}
{{- end }}
{{- if .Values.persistentVolume.selector }}
selector:
{{- toYaml .Values.persistentVolume.selector | nindent 8 }}
{{- end }}
{{- end }}