-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathweb-indexing.yml
379 lines (356 loc) · 8.88 KB
/
web-indexing.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
#
# Copyright (c) 2022 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
#
#
---
apiVersion: v1
kind: Namespace
spec:
finalizers: null
metadata:
name: web-indexing
---
apiVersion: v1
kind: ConfigMap
metadata:
name: solr-cluster-config
namespace: web-indexing
data:
solrHeap: 12g
solrHome: /store/data
solrLogsDir: /store/logs
solrPort: '8983'
solrHost: solr-service.web-indexing.svc.cluster.local
zkHost: zookeeper-service.web-indexing.svc.cluster.local:2181
---
apiVersion: v1
kind: Service
metadata:
namespace: web-indexing
name: solr-cluster
labels:
app: web-indexing-solr
spec:
clusterIP: None
selector:
app: web-indexing-solr
---
apiVersion: v1
kind: Service
metadata:
namespace: web-indexing
name: solr-service
labels:
app: web-indexing-solr
spec:
ports:
- protocol: TCP
port: 8983
targetPort: 8983
type: NodePort
selector:
app: web-indexing-solr
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: web-indexing
name: web-indexing-solr
spec:
selector:
matchLabels:
app: web-indexing-solr
replicas: 1
template:
metadata:
labels:
app: web-indexing-solr
spec:
terminationGracePeriodSeconds: 10
restartPolicy: Always
containers:
- name: solr
image: solr:8.1.1
resources:
requests:
memory: 2Gi
cpu: 1
limits:
memory: 4Gi
cpu: 2
imagePullPolicy: IfNotPresent
readinessProbe:
tcpSocket:
port: 8983
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8983
initialDelaySeconds: 15
periodSeconds: 20
volumeMounts:
- name: volsolr
mountPath: /store
ports:
- name: solrport
containerPort: 8983
env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: SOLR_HOME
valueFrom:
configMapKeyRef:
name: solr-cluster-config
key: solrHome
- name: ZK_HOST
valueFrom:
configMapKeyRef:
name: solr-cluster-config
key: zkHost
- name: POD_HOST_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: SOLR_HOST
valueFrom:
configMapKeyRef:
name: solr-cluster-config
key: solrHost
- name: SOLR_LOGS_DIR
valueFrom:
configMapKeyRef:
name: solr-cluster-config
key: solrLogsDir
- name: SOLR_HEAP
valueFrom:
configMapKeyRef:
name: solr-cluster-config
key: solrHeap
initContainers:
- name: init-solr-data
image: busybox:stable
command:
- "/bin/sh"
- "-c"
- "if [ ! -d $SOLR_HOME/lib ] ; then mkdir -p $SOLR_HOME/lib && chown -R 8983:8983 $SOLR_HOME ; else true; fi"
env:
- name: SOLR_HOME
valueFrom:
configMapKeyRef:
name: solr-cluster-config
key: solrHome
volumeMounts:
- name: volsolr
mountPath: /store
- name: init-solr-logs
image: busybox:stable
command:
- "/bin/sh"
- "-c"
- "if [ ! -d $SOLR_LOGS_DIR ] ; then mkdir -p $SOLR_LOGS_DIR && chown 8983:8983 $SOLR_LOGS_DIR ; else true; fi"
env:
- name: SOLR_LOGS_DIR
valueFrom:
configMapKeyRef:
name: solr-cluster-config
key: solrLogsDir
volumeMounts:
- name: volsolr
mountPath: /store
- name: init-solr-xml
image: solr:8.1.1
command:
- "/bin/sh"
- "-c"
- "if [ ! -f $SOLR_HOME/solr.xml ] ; then cp /opt/solr/server/solr/solr.xml $SOLR_HOME/solr.xml;\
sed -i \"s/<solr>/<solr><str name='sharedLib'>\\/store\\/data\\/lib<\\/str>/g\" $SOLR_HOME/solr.xml ; else true; fi "
env:
- name: SOLR_HOME
valueFrom:
configMapKeyRef:
name: solr-cluster-config
key: solrHome
volumeMounts:
- name: volsolr
mountPath: /store
serviceName: solr-cluster
volumeClaimTemplates:
- metadata:
name: volsolr
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: web-indexing
name: web-indexing-zookeeper-config
data:
ensemble: "web-indexing-zookeeper-0"
jvm.heap: "1G"
tick_time: "2000"
init: "10"
sync: "5"
client.cnxns: "60"
snap.retain: "3"
purge.interval: "1"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: web-indexing-zookeeper-ensemble-config
namespace: web-indexing
data:
zooDataDir: /store/data
zooDataLogDir: /store/datalog
zooLogDir: /store/logs
zooServers: server.1=web-indexing-zookeeper-0.web-indexing:2888:3888
zooStandaloneEnabled: 'false'
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
namespace: web-indexing
name: web-indexing-zookeeper-pdb
spec:
selector:
matchLabels:
app: zookeeper
minAvailable: 2
---
apiVersion: v1
kind: Service
metadata:
namespace: web-indexing
name: zookeeper-ensemble
labels:
app: web-indexing-zookeeper
spec:
clusterIP: None
selector:
app: web-indexing-zookeeper
---
apiVersion: v1
kind: Service
metadata:
namespace: web-indexing
name: zookeeper-headless
labels:
app: web-indexing-zookeeper
spec:
ports:
- port: 2888
name: server
- port: 3888
name: leader-election
selector:
app: web-indexing-zookeeper
---
apiVersion: v1
kind: Service
metadata:
namespace: web-indexing
name: zookeeper-service
labels:
app: web-indexing-zookeeper
spec:
ports:
- port: 2181
protocol: TCP
targetPort: 2181
type: NodePort
selector:
app: web-indexing-zookeeper
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: web-indexing
name: web-indexing-zookeeper
spec:
selector:
matchLabels:
app: web-indexing-zookeeper
serviceName: web-indexing-zookeeper-headless
replicas: 1
template:
metadata:
labels:
app: web-indexing-zookeeper
spec:
securityContext:
runAsUser: 1000
fsGroup: 1000
containers:
- name: zookeeper
imagePullPolicy: Always
image: gcr.io/google_samples/k8szk:v1
ports:
- containerPort: 2181
name: client
- containerPort: 2888
name: server
- containerPort: 3888
name: leader-election
env:
- name: ZK_ENSEMBLE
valueFrom:
configMapKeyRef:
name: web-indexing-zookeeper-config
key: ensemble
- name: ZK_HEAP_SIZE
valueFrom:
configMapKeyRef:
key: jvm.heap
name: web-indexing-zookeeper-config
- name: ZK_TICK_TIME
valueFrom:
configMapKeyRef:
key: tick_time
name: web-indexing-zookeeper-config
- name: ZK_SYNC_LIMIT
valueFrom:
configMapKeyRef:
key: tick_time
name: web-indexing-zookeeper-config
- name: ZK_MAX_CLIENT_CNXNS
valueFrom:
configMapKeyRef:
key: client.cnxns
name: web-indexing-zookeeper-config
- name: ZK_SNAP_RETAIN_COUNT
valueFrom:
configMapKeyRef:
key: snap.retain
name: web-indexing-zookeeper-config
- name: ZK_PURGE_INTERVAL
valueFrom:
configMapKeyRef:
key: purge.interval
name: web-indexing-zookeeper-config
- name: ZK_CLIENT_PORT
value: "2181"
- name: ZK_SERVER_PORT
value: "2888"
- name: ZK_ELECTION_PORT
value: "3888"
command:
- sh
- -c
- zkGenConfig.sh && zkServer.sh start-foreground