902f31ef6088890458f8f580ed45360b5bd9881d
[oom.git] / kubernetes / aai / 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.disableAaiElasticsearch }}
16 apiVersion: extensions/v1beta1
17 kind: Deployment
18 metadata:
19   name: aai-elasticsearch
20   namespace: "{{ .Values.nsPrefix }}"
21 spec:
22   replicas: {{ .Values.elasticsearchReplicas }}
23   selector:
24     matchLabels:
25       app: aai-elasticsearch
26   template:
27     metadata:
28       labels:
29         app: aai-elasticsearch
30       name: aai-elasticsearch
31     spec:
32       initContainers:
33       - command:
34         - /bin/sh
35         - -c
36         - |
37           mkdir -p /logroot/elasticsearch/es-data
38           chmod -R 777 /logroot/elasticsearch/es-data
39           chown -R root:root /logroot
40         env:
41         - name: NAMESPACE
42           valueFrom:
43             fieldRef:
44               apiVersion: v1
45               fieldPath: metadata.namespace
46         securityContext:
47           privileged: true
48         image: {{ .Values.image.es_bb }}
49         imagePullPolicy: {{ .Values.pullPolicy }}
50         name: init-sysctl
51         volumeMounts:
52         - name: elasticsearch-data
53           mountPath: /logroot/
54       hostname: aai-elasticsearch
55       containers:
56       - name: aai-elasticsearch
57         image: "{{ .Values.image.elasticsearchImage }}:{{ .Values.image.elasticsearchVersion }}"
58         imagePullPolicy: {{ .Values.pullPolicy }}
59         ports:
60         - containerPort: 9200
61         readinessProbe:
62           tcpSocket:
63             port: 9200
64           initialDelaySeconds: 5
65           periodSeconds: 10
66         volumeMounts:
67         - name: localtime
68           mountPath: /etc/localtime
69           readOnly: true
70         - name: elasticsearch-config
71           subPath: elasticsearch.yml
72           mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
73         - name: elasticsearch-data
74           mountPath: /usr/share/elasticsearch/data
75       volumes:
76       - name: localtime
77         hostPath:
78           path: /etc/localtime
79       - name: elasticsearch-config
80         configMap:
81           name: aai-elasticsearch-configmap
82       - name: elasticsearch-data
83         hostPath:
84           path: "/dockerdata-nfs/{{ .Values.nsPrefix }}/aai/elasticsearch/data"
85       imagePullSecrets:
86       - name: "{{ .Values.nsPrefix }}-docker-registry-key"
87 #{{ end }}