-
Notifications
You must be signed in to change notification settings - Fork 81
/
thirdparty.yml
397 lines (392 loc) · 10.6 KB
/
thirdparty.yml
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
#
# Copyright © 2016-2020 The Thingsboard Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apiVersion: v1
kind: ConfigMap
metadata:
name: tb-zookeeper
namespace: thingsboard
data:
start-node.sh: |
#!/bin/sh
set -ex;
mkdir -p "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR";
echo $HOSTNAME| rev | cut -d "-" -f1 | rev > "$ZOO_DATA_DIR/myid"
/apache-zookeeper-3.5.7-bin/bin/zkServer.sh start-foreground /conf/zoo.cfg
zoo.cfg: |+
dataDir=/data
dataLogDir=/datalog
tickTime=2000
initLimit=5
syncLimit=2
maxClientCnxns=200
standaloneEnabled=true
server.0=zookeeper-0.zookeeper-headless.thingsboard.svc.cluster.local:2888:3888;2181
server.1=zookeeper-1.zookeeper-headless.thingsboard.svc.cluster.local:2888:3888;2181
server.2=zookeeper-2.zookeeper-headless.thingsboard.svc.cluster.local:2888:3888;2181
log4j.properties: |+
zookeeper.root.logger=INFO, CONSOLE
zookeeper.console.threshold=INFO
log4j.rootLogger=${zookeeper.root.logger}
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=${zookeeper.console.threshold}
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: zookeeper
namespace: thingsboard
spec:
serviceName: "zookeeper-headless"
replicas: 3
podManagementPolicy: Parallel
selector:
matchLabels:
app: zookeeper
template:
metadata:
labels:
app: zookeeper
spec:
containers:
- name: zookeeper
imagePullPolicy: Always
image: zookeeper:3.5.7
ports:
- containerPort: 2181
name: client
- containerPort: 2888
name: server
- containerPort: 3888
name: election
resources:
limits:
cpu: "200m"
memory: 800Mi
requests:
cpu: "200m"
memory: 800Mi
command: ["/conf/start-node.sh"]
readinessProbe:
periodSeconds: 60
tcpSocket:
port: 2181
livenessProbe:
periodSeconds: 60
tcpSocket:
port: 2181
env:
- name: JVMFLAGS
value: "-Dzookeeper.electionPortBindRetry=0"
- name: HOSTNAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: conf
mountPath: /conf
readOnly: false
- name: data
mountPath: /data
readOnly: false
- name: datalog
mountPath: /datalog
readOnly: false
volumes:
- name: conf
configMap:
name: tb-zookeeper
defaultMode: 0755
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 100Mi
- metadata:
name: datalog
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 100Mi
---
apiVersion: v1
kind: Service
metadata:
name: zookeeper
namespace: thingsboard
spec:
type: ClusterIP
ports:
- port: 2181
targetPort: 2181
name: client
- port: 2888
targetPort: 2888
name: server
- port: 3888
targetPort: 3888
name: election
selector:
app: zookeeper
---
apiVersion: v1
kind: Service
metadata:
name: zookeeper-headless
namespace: thingsboard
labels:
app: zookeeper
spec:
ports:
- port: 2181
targetPort: 2181
name: client
- port: 2888
targetPort: 2888
name: server
- port: 3888
targetPort: 3888
name: election
clusterIP: None
selector:
app: zookeeper
---
apiVersion: v1
kind: ConfigMap
metadata:
name: tb-kafka
namespace: thingsboard
data:
start-node.sh: |
#!/bin/sh
cp /tmp/tools-log4j.properties /opt/kafka/config/tools-log4j.properties
cp /tmp/log4j.properties /opt/kafka/config/log4j.properties
/usr/bin/start-kafka.sh
tools-log4j.properties: |+
log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.properties: |+
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
# Change the line below to adjust ZK client logging
log4j.logger.org.apache.zookeeper=INFO
# Change the two lines below to adjust the general broker logging level (output to server.log and stdout)
log4j.logger.kafka=INFO
log4j.logger.org.apache.kafka=INFO
# Change to DEBUG or TRACE to enable request logging
log4j.logger.kafka.request.logger=WARN, stdout
log4j.additivity.kafka.request.logger=false
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: tb-kafka
namespace: thingsboard
spec:
serviceName: "tb-kafka"
podManagementPolicy: Parallel
selector:
matchLabels:
app: tb-kafka
template:
metadata:
labels:
app: tb-kafka
spec:
containers:
- name: server
imagePullPolicy: Always
image: wurstmeister/kafka:2.12-2.2.1
ports:
- containerPort: 9092
name: kafka-int
resources:
limits:
cpu: "1000m"
memory: 4000Mi
requests:
cpu: "1000m"
memory: 4000Mi
command: ["/tmp/start-node.sh"]
readinessProbe:
periodSeconds: 20
tcpSocket:
port: 9092
livenessProbe:
initialDelaySeconds: 25
periodSeconds: 5
tcpSocket:
port: 9092
env:
- name: BROKER_ID_COMMAND
value: "hostname | cut -d'-' -f3"
- name: KAFKA_ZOOKEEPER_CONNECT
value: "zookeeper:2181"
- name: KAFKA_LISTENERS
value: "INSIDE://:9092"
- name: KAFKA_ADVERTISED_LISTENERS
value: "INSIDE://:9092"
- name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
value: "INSIDE:PLAINTEXT"
- name: KAFKA_INTER_BROKER_LISTENER_NAME
value: "INSIDE"
- name: KAFKA_CREATE_TOPICS
value: "js_eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb_transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb_rule_engine:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600"
- name: KAFKA_AUTO_CREATE_TOPICS_ENABLE
value: "false"
- name: KAFKA_LOG_RETENTION_BYTES
value: "1073741824"
- name: KAFKA_LOG_SEGMENT_BYTES
value: "268435456"
- name: KAFKA_LOG_RETENTION_MS
value: "300000"
- name: KAFKA_LOG_CLEANUP_POLICY
value: "delete"
- name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
value: "1"
- name: KAFKA_TRANSACTION_STATE_LOG_MIN_ISR
value: "1"
- name: KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR
value: "1"
- name: KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS
value: "3000"
- name: KAFKA_PORT
value: "9092"
- name: KAFKA_LOG_DIRS
value: "/kafka-logs/kafka"
volumeMounts:
- name: logs
mountPath: /kafka-logs
readOnly: false
- name: start
mountPath: /tmp
readOnly: false
- name: app-logs
mountPath: /opt/kafka/logs
readOnly: false
- name: config
mountPath: /opt/kafka/config
readOnly: false
volumes:
- name: start
configMap:
name: tb-kafka
defaultMode: 0755
volumeClaimTemplates:
- metadata:
name: logs
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 200Mi
- metadata:
name: app-logs
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 200Mi
- metadata:
name: config
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Mi
---
apiVersion: v1
kind: Service
metadata:
name: tb-kafka
namespace: thingsboard
spec:
type: ClusterIP
selector:
app: tb-kafka
ports:
- port: 9092
name: kafka-int
clusterIP: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tb-redis
namespace: thingsboard
spec:
selector:
matchLabels:
app: tb-redis
template:
metadata:
labels:
app: tb-redis
spec:
containers:
- name: server
imagePullPolicy: Always
image: redis:4.0
ports:
- containerPort: 6379
resources:
limits:
cpu: "300m"
memory: 1200Mi
requests:
cpu: "300m"
memory: 1200Mi
readinessProbe:
periodSeconds: 5
tcpSocket:
port: 6379
livenessProbe:
periodSeconds: 5
tcpSocket:
port: 6379
volumeMounts:
- mountPath: /data
name: redis-data
volumes:
- name: redis-data
emptyDir: {}
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: tb-redis
namespace: thingsboard
spec:
type: ClusterIP
selector:
app: tb-redis
ports:
- name: tb-redis-port
port: 6379
---