/
thingssearch-deployment.yaml
316 lines (316 loc) · 16.1 KB
/
thingssearch-deployment.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
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
315
316
# Copyright (c) 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0
#
# SPDX-License-Identifier: EPL-2.0
{{- if .Values.thingsSearch.enabled -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ditto.fullname" . }}-thingssearch
labels:
app.kubernetes.io/name: {{ include "ditto.name" . }}-thingssearch
{{ include "ditto.labels" . | indent 4 }}
spec:
replicas: {{ .Values.thingsSearch.replicaCount }}
strategy:
{{- with .Values.thingsSearch.updateStrategy }}
{{- toYaml . | nindent 4 }}
{{- end }}
minReadySeconds: {{ .Values.thingsSearch.minReadySeconds }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "ditto.name" . }}-thingssearch
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "ditto.name" . }}-thingssearch
app.kubernetes.io/instance: {{ .Release.Name }}
actorSystemName: {{ .Values.pekko.actorSystemName }}
{{- with .Values.thingsSearch.additionalLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
{{- if .Values.global.prometheus.enabled }}
prometheus.io/scrape: "true"
prometheus.io/path: "{{ .Values.global.prometheus.path }}"
prometheus.io/port: "{{ .Values.global.prometheus.port }}"
{{- end }}
checksum/mongodb-config: {{ include (print $.Template.BasePath "/mongodb-secret.yaml") . | sha256sum }}
{{- with .Values.thingsSearch.additionalAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.rbac.enabled }}
serviceAccountName: {{ template "ditto.serviceAccountName" . }}
{{- end }}
{{- with .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
fsGroup: 1000
initContainers:
{{- if .Values.global.logging.logFiles.enabled }}
- name: change-volume-owner
image: busybox
securityContext:
runAsUser: 0
command: [ "sh", "-c", "chown -R 1000:1000 /var/log/ditto && echo 'changed ownership of /var/log/ditto to 1000:1000'" ]
volumeMounts:
- name: ditto-log-files-directory
mountPath: /var/log/ditto
{{- end }}
topologySpreadConstraints:
- maxSkew: {{ .Values.thingsSearch.topologySpreadConstraints.maxSkew }}
topologyKey: {{ .Values.thingsSearch.topologySpreadConstraints.topologyKey }}
whenUnsatisfiable: {{ .Values.thingsSearch.topologySpreadConstraints.whenUnsatisfiable }}
labelSelector:
matchLabels:
app.kubernetes.io/name: {{ include "ditto.name" . }}-thingssearch
containers:
- name: {{ .Chart.Name }}-thingssearch
image: {{ printf "%s:%s" .Values.thingsSearch.image.repository ( default .Chart.AppVersion ( default .Values.dittoTag .Values.thingsSearch.image.tag ) ) }}
imagePullPolicy: {{ .Values.thingsSearch.image.pullPolicy }}
env:
{{- if not .Values.global.logging.customConfigFile.enabled }}
- name: DITTO_LOGGING_DISABLE_SYSOUT_LOG
value: "{{ if .Values.global.logging.sysout.enabled }}false{{ else }}true{{ end }}"
- name: DITTO_LOGGING_FILE_APPENDER
value: "{{ if .Values.global.logging.logFiles.enabled }}true{{ else }}false{{ end }}"
{{- end }}
- name: DITTO_TRACING_ENABLED
value: "{{ .Values.global.tracing.enabled }}"
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: "{{ tpl .Values.global.tracing.otelExporterOtlpEndpoint . }}"
- name: DITTO_TRACING_SAMPLER
value: "{{ .Values.global.tracing.sampler }}"
- name: DITTO_TRACING_RANDOM_SAMPLER_PROBABILITY
value: "{{ .Values.global.tracing.randomSampler.probability }}"
- name: DITTO_TRACING_ADAPTIVE_SAMPLER_THROUGHPUT
value: "{{ .Values.global.tracing.adaptiveSampler.throughput }}"
{{- if .Values.global.logging.logstash.enabled }}
- name: DITTO_LOGGING_LOGSTASH_SERVER
value: "{{ .Values.global.logging.logstash.endpoint }}"
{{- end }}
- name: POD_LABEL_SELECTOR
value: "app.kubernetes.io/name=%s"
- name: POD_NAMESPACE
value: {{.Release.Namespace}}
- name: INSTANCE_INDEX
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: HOSTNAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: DISCOVERY_METHOD
value: "kubernetes-api"
- name: TZ
value: "{{ .Values.global.timezone }}"
- name: JAVA_TOOL_OPTIONS
value: >
{{ .Values.global.jvmOptions }}
-XX:ActiveProcessorCount={{ .Values.thingsSearch.jvm.activeProcessorCount }}
-XX:MaxRAMPercentage={{ .Values.thingsSearch.jvm.heapRamPercentage }}
-XX:InitialRAMPercentage={{ .Values.thingsSearch.jvm.heapRamPercentage }}
-XX:MaxGCPauseMillis={{ .Values.thingsSearch.jvm.maxGcPauseMillis }}
{{ .Values.thingsSearch.additionalJvmOptions }}
{{ .Values.global.pekkoOptions }}
{{- if .Values.global.logging.customConfigFile.enabled }}
-Dlogback.configurationFile=/opt/ditto/{{ .Values.global.logging.customConfigFile.fileName }}
{{- end }}
{{ join " " .Values.thingsSearch.systemProps }}
- name: MONGO_DB_SSL_ENABLED
value: "{{ if .Values.dbconfig.thingsSearch.ssl }}true{{ else }}false{{ end }}"
- name: MONGO_DB_URI
valueFrom:
secretKeyRef:
name: {{ .Values.dbconfig.uriSecret | default ( printf "%s-mongodb-secret" ( include "ditto.fullname" . )) }}
key: thingsSearch-uri
- name: MONGO_DB_CONNECTION_MIN_POOL_SIZE
value: "{{ .Values.thingsSearch.config.mongodb.minPoolSize }}"
- name: MONGO_DB_CONNECTION_POOL_SIZE
value: "{{ .Values.thingsSearch.config.mongodb.maxPoolSize }}"
- name: MONGO_DB_CONNECTION_POOL_IDLE_TIME
value: "{{ .Values.thingsSearch.config.mongodb.maxPoolIdleTime }}"
{{- if .Values.global.prometheus.enabled }}
- name: PROMETHEUS_PORT
value: "{{ .Values.global.prometheus.port }}"
{{- end }}
- name: CLUSTER_BS_REQUIRED_CONTACTS
value: "{{ .Values.global.cluster.requiredContactPoints }}"
- name: DITTO_DDATA_NUMBER_OF_SHARDS
value: "{{ .Values.global.cluster.ddata.numberOfShards }}"
- name: DITTO_DDATA_MAX_DELTA_ELEMENTS
value: "{{ .Values.global.cluster.ddata.maxDeltaElements }}"
- name: CLUSTER_NUMBER_OF_SHARDS
value: "{{ .Values.global.cluster.numberOfShards }}"
- name: CLUSTER_DOWNING_STABLE_AFTER
value: "{{ .Values.global.cluster.downingStableAfter }}"
- name: CLUSTER_DOWNING_DOWN_ALL_WHEN_UNSTABLE
value: "{{ .Values.global.cluster.downAllWhenUnstable }}"
- name: REMOTE_MAX_FRAMESIZE
value: "{{ .Values.global.limits.akkaClusterMaxFramesize }}"
- name: LIMITS_THINGS_MAX_SIZE
value: "{{ .Values.global.limits.thingsMaxSize }}"
- name: LIMITS_POLICIES_MAX_SIZE
value: "{{ .Values.global.limits.policiesMaxSize }}"
- name: LIMITS_POLICIES_MAX_IMPORTS
value: "{{ .Values.global.limits.policiesMaxImports }}"
- name: LIMITS_MESSAGES_MAX_SIZE
value: "{{ .Values.global.limits.messagesMaxSize }}"
- name: LIMITS_MESSAGES_HEADERS_SIZE
value: "{{ .Values.global.limits.maxHeadersSize }}"
- name: LIMITS_MESSAGES_AUTH_SUBJECTS_COUNT
value: "{{ .Values.global.limits.maxAuthSubjectsCount }}"
- name: MONGO_DB_READ_PREFERENCE
value: "{{ .Values.thingsSearch.config.mongodb.searchReadPreference }}"
- name: QUERY_PERSISTENCE_MONGO_DB_READ_CONCERN
value: "{{ .Values.thingsSearch.config.mongodb.queryReadConcern }}"
- name: MONGO_DB_WRITE_CONCERN
value: "{{ .Values.thingsSearch.config.mongodb.searchWriteConcern }}"
- name: UPDATER_PERSISTENCE_MONGO_DB_READ_CONCERN
value: "{{ .Values.thingsSearch.config.mongodb.updaterPersistenceReadConcern }}"
- name: UPDATER_PERSISTENCE_MONGO_DB_READ_PREFERENCE
value: "{{ .Values.thingsSearch.config.mongodb.updaterPersistenceReadPreference }}"
- name: THINGS_SEARCH_UPDATER_STREAM_PERSISTENCE_WITH_ACKS_WRITE_CONCERN
value: "{{ .Values.thingsSearch.config.mongodb.searchWithAcksWriteConcern }}"
- name: THINGS_SEARCH_UPDATER_STREAM_POLICY_CACHE_SIZE
value: "{{ .Values.thingsSearch.config.updater.stream.policiesEnforcer.cache.maxSize }}"
- name: THINGS_SEARCH_UPDATER_STREAM_POLICY_CACHE_EXPIRY
value: "{{ .Values.thingsSearch.config.updater.stream.policiesEnforcer.cache.expireAfterWrite }}"
- name: THINGS_SEARCH_UPDATER_STREAM_POLICY_CACHE_EXPIRY_AFTER_ACCESS
value: "{{ .Values.thingsSearch.config.updater.stream.policiesEnforcer.cache.expireAfterAccess }}"
- name: THINGS_SEARCH_UPDATER_STREAM_THING_CACHE_SIZE
value: "{{ .Values.thingsSearch.config.updater.stream.thingCache.maxSize }}"
- name: THINGS_SEARCH_UPDATER_STREAM_THING_CACHE_EXPIRY
value: "{{ .Values.thingsSearch.config.updater.stream.thingCache.expireAfterWrite }}"
- name: THINGS_SEARCH_UPDATER_STREAM_THING_CACHE_EXPIRY_AFTER_ACCESS
value: "{{ .Values.thingsSearch.config.updater.stream.thingCache.expireAfterAccess }}"
- name: THINGS_SEARCH_UPDATER_STREAM_RETRIEVAL_PARALLELISM
value: "{{ .Values.thingsSearch.config.updater.stream.retrievalParallelism }}"
- name: THINGS_SEARCH_UPDATER_STREAM_PERSISTENCE_PARALLELISM
value: "{{ .Values.thingsSearch.config.updater.stream.persistence.parallelism }}"
- name: ACTIVITY_CHECK_INTERVAL
value: "{{ .Values.thingsSearch.config.updater.activityCheckInterval }}"
- name: BACKGROUND_SYNC_ENABLED
value: "{{ .Values.thingsSearch.config.updater.backgroundSync.enabled }}"
- name: BACKGROUND_SYNC_QUIET_PERIOD
value: "{{ .Values.thingsSearch.config.updater.backgroundSync.quietPeriod }}"
- name: BACKGROUND_SYNC_IDLE_TIMEOUT
value: "{{ .Values.thingsSearch.config.updater.backgroundSync.idleTimeout }}"
- name: BACKGROUND_SYNC_TOLERANCE_WINDOW
value: "{{ .Values.thingsSearch.config.updater.backgroundSync.toleranceWindow }}"
- name: BACKGROUND_SYNC_KEEP_EVENTS
value: "{{ .Values.thingsSearch.config.updater.backgroundSync.keepEvents }}"
- name: BACKGROUND_SYNC_THROTTLE_THROUGHPUT
value: "{{ .Values.thingsSearch.config.updater.backgroundSync.throttle.throughput }}"
- name: BACKGROUND_SYCN_THROTTLE_PERIOD
value: "{{ .Values.thingsSearch.config.updater.backgroundSync.throttle.period }}"
- name: DITTO_POLICIES_ENFORCER_CACHE_MAX_SIZE
value: "{{ .Values.thingsSearch.config.updater.stream.policiesEnforcer.cache.maxSize }}"
- name: DITTO_POLICIES_ENFORCER_CACHE_EXPIRE_AFTER_WRITE
value: "{{ .Values.thingsSearch.config.updater.stream.policiesEnforcer.cache.expireAfterWrite }}"
- name: DITTO_POLICIES_ENFORCER_CACHE_EXPIRE_AFTER_ACCESS
value: "{{ .Values.thingsSearch.config.updater.stream.policiesEnforcer.cache.expireAfterAccess }}"
{{- if .Values.thingsSearch.extraEnv }}
{{- toYaml .Values.thingsSearch.extraEnv | nindent 12 }}
{{- end }}
ports:
- name: remoting
containerPort: {{ .Values.pekko.remoting.port }}
protocol: TCP
- name: management
containerPort: {{ .Values.pekko.mgmthttp.port }}
protocol: TCP
{{- if .Values.global.prometheus.enabled }}
- name: prometheus
protocol: TCP
containerPort: {{ .Values.global.prometheus.port }}
{{- end }}
readinessProbe:
httpGet:
port: management
path: /ready
initialDelaySeconds: {{ .Values.thingsSearch.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.thingsSearch.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.thingsSearch.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.thingsSearch.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.thingsSearch.readinessProbe.failureThreshold }}
livenessProbe:
httpGet:
port: management
path: /alive
initialDelaySeconds: {{ .Values.thingsSearch.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.thingsSearch.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.thingsSearch.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.thingsSearch.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.thingsSearch.livenessProbe.failureThreshold }}
volumeMounts:
{{- if .Values.global.logging.customConfigFile.enabled }}
- name: ditto-custom-log-config
mountPath: /opt/ditto/{{ .Values.global.logging.customConfigFile.fileName }}
subPath: {{ .Values.global.logging.customConfigFile.fileName }}
{{- end }}
{{- if .Values.global.logging.logFiles.enabled }}
- name: ditto-log-files-directory
mountPath: /var/log/ditto
{{- end }}
resources:
requests:
cpu: {{ mulf .Values.thingsSearch.resources.cpu 1000 }}m
memory: {{ .Values.thingsSearch.resources.memoryMi }}Mi
limits:
# ## no cpu limit to avoid CFS scheduler limits
# ref: https://pekko.apache.org/docs/pekko/current/additional/deploying.html#deploying-to-kubernetes
# cpu: ""
memory: {{ .Values.thingsSearch.resources.memoryMi }}Mi
{{- if .Values.openshift.enabled }}
{{- with .Values.openshift.securityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- else }}
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
allowPrivilegeEscalation: false
{{- end }}
priorityClassName: "{{ .Values.thingsSearch.priorityClassName }}"
{{- with .Values.thingsSearch.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.thingsSearch.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.thingsSearch.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- if .Values.global.logging.customConfigFile.enabled }}
- name: ditto-custom-log-config
configMap:
name: {{ .Release.Name }}-logback-config-thingssearch-xml
{{- end }}
{{- if .Values.global.logging.logFiles.enabled }}
- name: ditto-log-files-directory
hostPath:
path: /var/log/ditto
type: DirectoryOrCreate
{{- end }}
{{- end }}