Merge changes I24367eac,I8dab41ae
[oom.git] / kubernetes / log / templates / elasticsearch-deployment.yaml
1 #{{ if not .Values.disableLogElasticsearch }}
2 apiVersion: extensions/v1beta1
3 kind: Deployment
4 metadata:
5   labels:
6     app: elasticsearch
7   name: elasticsearch
8   namespace: {{ .Values.nsPrefix }}-log
9 spec:
10   selector:
11     matchLabels:
12       app: elasticsearch
13   template:
14     metadata:
15       labels:
16         app: elasticsearch
17       name: elasticsearch
18     spec:
19       initContainers:
20       - command:
21         - /bin/sh
22         - -c
23         - |
24           sysctl -w vm.max_map_count=262144
25           mkdir -p /logroot/elasticsearch/logs
26           mkdir -p /logroot/elasticsearch/data
27           chmod -R 777 /logroot/elasticsearch
28           chown -R root:root /logroot
29         env:
30         - name: NAMESPACE
31           valueFrom:
32             fieldRef:
33               apiVersion: v1
34               fieldPath: metadata.namespace
35         securityContext:
36           privileged: true
37         image: {{ .Values.image.es_bb }}
38         imagePullPolicy: {{ .Values.pullPolicy }}
39         name: init-sysctl
40         volumeMounts:
41         - name: elasticsearch-logs
42           mountPath: /logroot/
43       containers:
44       - name: elasticsearch
45         image: {{ .Values.image.elasticsearch}}
46         ports:
47         - containerPort: 9200
48           name: http
49           protocol: TCP
50         - containerPort: 9300
51           name: transport
52           protocol: TCP
53         readinessProbe:
54           tcpSocket:
55             port: 9300
56         volumeMounts:
57          - mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
58            name: elasticsearch-conf
59            subPath: elasticsearch.yml
60          - mountPath: /usr/share/elasticsearch/data/
61            name: elasticsearch-data
62          - mountPath: /usr/share/elasticsearch/logs/
63            name: elasticsearch-logs
64       volumes:
65         - name: elasticsearch-data
66           persistentVolumeClaim:
67             claimName: elasticsearch-db
68         - name: elasticsearch-logs
69           hostPath:
70             path: /dockerdata-nfs/{{ .Values.nsPrefix }}/log/
71         - name: elasticsearch-conf
72           configMap:
73             name: elasticsearch-configmap
74             items:
75             - key: elasticsearch.yml
76               path: elasticsearch.yml
77 ---
78 apiVersion: v1
79 kind: ConfigMap
80 metadata:
81   name: elasticsearch-configmap
82   namespace: {{ .Values.nsPrefix }}-log
83 data:
84 {{ (.Files.Glob "resources/elasticsearch/conf/elasticsearch.yml").AsConfig | indent 2 }}
85 #{{ end }}
86