Add option to disable specific deployments
[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       annotations:
19         pod.beta.kubernetes.io/init-containers: '[
20           {
21               "command": ["sysctl", "-w", "vm.max_map_count=262144"],
22               "env": [
23                   {
24                       "name": "NAMESPACE",
25                       "valueFrom": {
26                           "fieldRef": {
27                               "apiVersion": "v1",
28                               "fieldPath": "metadata.namespace"
29                           }
30                       }
31                   }
32               ],
33               "securityContext": {
34                 "privileged": true
35               },
36               "image": "{{ .Values.image.es_bb }}",
37               "imagePullPolicy": "{{ .Values.pullPolicy }}",
38               "name": "init-sysctl"
39           }
40           ]'
41     spec:
42       containers:
43       - name: elasticsearch
44         image: {{ .Values.image.elasticsearch}}
45         ports:
46         - containerPort: 9200
47           name: http
48           protocol: TCP
49         - containerPort: 9300
50           name: transport
51           protocol: TCP
52         readinessProbe:
53           tcpSocket:
54             port: 9200
55         volumeMounts:
56          - mountPath: /usr/share/elasticsearch/conf/
57            name: elasticsearch-conf
58          - mountPath: /usr/share/elasticsearch/data/
59            name: elasticsearch-data
60          - mountPath: /usr/share/elasticsearch/logs/
61            name: elasticsearch-logs
62       volumes:
63         - name: elasticsearch-data
64           persistentVolumeClaim:
65             claimName: elasticsearch-db
66         - name: elasticsearch-logs
67           hostPath:
68             path: /dockerdata-nfs/{{ .Values.nsPrefix }}/log/elasticsearch/logs
69         - name: elasticsearch-conf
70           configMap:
71             name: elasticsearch-configmap
72             items:
73             - key: elasticsearch.yml
74               path: elasticsearch.yml
75 ---
76 apiVersion: v1
77 kind: ConfigMap
78 metadata:
79   name: elasticsearch-configmap
80   namespace: {{ .Values.nsPrefix }}-log
81 data:
82 {{ (.Files.Glob "resources/elasticsearch/conf/elasticsearch.yml").AsConfig | indent 2 }}
83 #{{ end }}