Merge "Script_version addiition in robot config"
[oom.git] / kubernetes / log / templates / elasticsearch-deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 #{{ if not .Values.disableLogElasticsearch }}
16 apiVersion: extensions/v1beta1
17 kind: Deployment
18 metadata:
19   labels:
20     app: elasticsearch
21   name: log-elasticsearch
22   namespace: {{ .Values.nsPrefix }}
23 spec:
24   replicas: {{ .Values.elasticsearchReplicas }}
25   selector:
26     matchLabels:
27       app: elasticsearch
28   template:
29     metadata:
30       labels:
31         app: elasticsearch
32       name: log-elasticsearch
33     spec:
34       initContainers:
35       - command:
36         - /bin/sh
37         - -c
38         - |
39           sysctl -w vm.max_map_count=262144
40           mkdir -p /logroot/elasticsearch/logs
41           mkdir -p /logroot/elasticsearch/data
42           chmod -R 777 /logroot/elasticsearch
43           chown -R root:root /logroot
44         env:
45         - name: NAMESPACE
46           valueFrom:
47             fieldRef:
48               apiVersion: v1
49               fieldPath: metadata.namespace
50         securityContext:
51           privileged: true
52         image: {{ .Values.image.es_bb }}
53         imagePullPolicy: {{ .Values.pullPolicy }}
54         name: init-sysctl
55         volumeMounts:
56         - name: elasticsearch-logs
57           mountPath: /logroot/
58       containers:
59       - name: elasticsearch
60         image: {{ .Values.image.elasticsearch}}
61         ports:
62         - containerPort: 9200
63           name: http
64           protocol: TCP
65         - containerPort: 9300
66           name: transport
67           protocol: TCP
68         readinessProbe:
69           tcpSocket:
70             port: 9300
71         volumeMounts:
72          - mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
73            name: elasticsearch-conf
74            subPath: elasticsearch.yml
75          - mountPath: /usr/share/elasticsearch/data/
76            name: elasticsearch-data
77          - mountPath: /usr/share/elasticsearch/logs/
78            name: elasticsearch-logs
79       volumes:
80         - name: elasticsearch-data
81           persistentVolumeClaim:
82             claimName: elasticsearch-db
83         - name: elasticsearch-logs
84           hostPath:
85             path: {{ .Values.dataRootDir }}/{{ .Values.nsPrefix }}/log/
86         - name: elasticsearch-conf
87           configMap:
88             name: log-elasticsearch-configmap
89             items:
90             - key: elasticsearch.yml
91               path: elasticsearch.yml
92 ---
93 apiVersion: v1
94 kind: ConfigMap
95 metadata:
96   name: log-elasticsearch-configmap
97   namespace: {{ .Values.nsPrefix }}
98 data:
99 {{ (.Files.Glob "resources/elasticsearch/conf/elasticsearch.yml").AsConfig | indent 2 }}
100 #{{ end }}
101