-
Notifications
You must be signed in to change notification settings - Fork 4
/
moloch-capture.yaml
117 lines (116 loc) · 3.58 KB
/
moloch-capture.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/v1
kind: StatefulSet
metadata:
name: {{ template "moloch.fullname" . }}-capture
labels:
app: {{ template "moloch.name" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
role: capture
spec:
serviceName: {{ template "moloch.fullname" . }}-headless
replicas: {{ .Values.molochConfig.workerNodes }}
selector:
matchLabels:
app: {{ template "moloch.name" . }}
role: capture
template:
metadata:
name: {{ template "moloch.name" . }}-capture
labels:
app: {{ template "moloch.name" . }}
role: capture
annotations:
networks: '[
{{- if ne .Values.networks.useHostNeworking true }}
{ "name": {{ .Values.networks.overlay | quote }} },
{ "name": {{ .Values.networks.passive | quote }} }
{{- else }}
{ "name": {{ .Values.networks.overlay | quote }} }
{{- end }}
]'
spec:
initContainers:
- name: verifynode
image: {{ .Values.images.runner }}
env:
- name: INTERFACE
valueFrom:
secretKeyRef:
name: passive-interface
key: interface
- name: STARTUP_SCRIPT
value: |
#!/bin/bash
set -e
sleep 10
if [ ! -f /sys/class/net/$INTERFACE/operstate ]; then
echo "Network interface '$INTERFACE' not found, exiting..."
exit 1
fi
containers:
- name: moloch-capture
image: {{ .Values.images.moloch }}
command: ["bash", "-c", "yes | cp /tmp/moloch/config.ini /data/moloch/etc/config.ini && /data/moloch/docker-entrypoint.sh"]
imagePullPolicy: Always
securityContext:
capabilities:
add:
- NET_ADMIN
- NET_RAW
- IPC_LOCK
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ES_HOST
value: data-service
- name: CLUSTER_PW
value: {{ .Values.molochConfig.env.clusterpw }}
- name: ADMIN_PW
value: {{ .Values.molochConfig.env.adminpw }}
- name: SENSOR
value: "true"
- name: INTERFACE
valueFrom:
secretKeyRef:
name: passive-interface
key: interface
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
ports:
- name: cport-8005
containerPort: 8005
resources:
requests:
cpu: {{ .Values.molochConfig.requests.cpu | quote }}
memory: {{ .Values.molochConfig.requests.memory | quote }}
limits:
cpu: {{ .Values.molochConfig.limits.cpu | quote }}
memory: {{ .Values.molochConfig.limits.memory | quote }}
volumeMounts:
- mountPath: /data/moloch/raw
name: molochraw
- mountPath: /tmp/moloch/config.ini
subPath: config.ini
name: moloch-config
volumes:
- name: molochraw
hostPath:
path: {{ .Values.volumes.raw }}
- name: moloch-config
configMap:
name: {{ template "moloch.fullname" . }}-config
restartPolicy: Always
{{- if .Values.networks.useHostNeworking }}
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
{{- end }}
dnsConfig:
searches:
- {{ template "moloch.fullname" . }}-headless.{{ .Release.Namespace }}.svc.cluster.local
nodeSelector:
{{ .Values.nodeSelector.worker }} : "true"