/
statefulset.dev.yml
86 lines (86 loc) · 2.39 KB
/
statefulset.dev.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
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: ${ELASTICSEARCH_HOST}
labels:
app: ${K8S_NAMESPACE}-${CONTEXT}-${BRANCH_HASH}
git/branch: ${BRANCH_NAME}
annotations:
git/commit: ${COMMIT}
gitlab/job: "${JOB_ID}"
spec:
serviceName: ${ELASTICSEARCH_HOST}
replicas: 1
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: ${ELASTICSEARCH_HOST}
spec:
securityContext:
fsGroup: 1000
initContainers:
- name: init-sysctl
image: busybox
imagePullPolicy: IfNotPresent
securityContext:
privileged: true
command: ["sysctl", "-w", "vm.max_map_count=262144"]
containers:
- name: ${ELASTICSEARCH_HOST}
resources:
limits:
memory: "1024Mi"
cpu: "1.5"
requests:
memory: "512Mi"
cpu: "0.5"
securityContext:
privileged: true
runAsUser: 1000
capabilities:
add:
- IPC_LOCK
- SYS_RESOURCE
image: ${IMAGE_NAME}:${IMAGE_TAG}
env:
- name: ES_JAVA_OPTS
valueFrom:
configMapKeyRef:
name: ${K8S_NAMESPACE}-es-config-${BRANCH_HASH}
key: ES_JAVA_OPTS
livenessProbe:
httpGet:
scheme: HTTP
path: /_cluster/health
port: ${PORT}
initialDelaySeconds: 60
periodSeconds: 5
readinessProbe:
httpGet:
scheme: HTTP
path: /_cluster/health?local=true
port: ${PORT}
initialDelaySeconds: 60
ports:
- containerPort: ${PORT}
name: es-http
- containerPort: ${ES_INTER_NODE}
name: es-transport
volumeMounts:
- name: ${K8S_NAMESPACE}-es-data-${BRANCH_HASH}
mountPath: /usr/share/elasticsearch/data
- name: ${K8S_NAMESPACE}-elasticsearch-config-${BRANCH_HASH}
mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
subPath: elasticsearch.yml
volumes:
- name: ${K8S_NAMESPACE}-elasticsearch-config-${BRANCH_HASH}
configMap:
name: ${K8S_NAMESPACE}-es-config-${BRANCH_HASH}
items:
- key: elasticsearch.yml
path: elasticsearch.yml
- name: ${K8S_NAMESPACE}-es-data-${BRANCH_HASH}
emptyDir: {}