Merge "Add Standardized Configuration to SDN-C Chart"
[oom.git] / kubernetes / sdc / charts / sdc-es / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, AT&T, 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 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
32     spec:
33       initContainers:
34       - name: {{ include "common.name" . }}-logs-init
35         command:
36         - /bin/bash
37         - "-c"
38         - |
39           mkdir -p /ubuntu-init/ASDC/ASDC-ES/
40           chmod -R 777 /ubuntu-init/
41         image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.global.ubuntuInitImage }}"
42         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43         volumeMounts:
44         - name: {{ include "common.fullname" . }}-logs
45           mountPath: /ubuntu-init/
46       containers:
47         - name: {{ include "common.name" . }}
48           image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
49           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50           ports:
51           - containerPort: {{ .Values.service.internalPort }}
52           - containerPort: {{ .Values.service.internalPort2 }}
53           # disable liveness probe when breakpoints set in debugger
54           # so K8s doesn't restart unresponsive container
55           {{- if eq .Values.liveness.enabled true }}
56           livenessProbe:
57             tcpSocket:
58               port: {{ .Values.service.internalPort }}
59             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
60             periodSeconds: {{ .Values.liveness.periodSeconds }}
61           {{ end -}}
62           readinessProbe:
63             httpGet:
64               path: "_cluster/health?wait_for_status=yellow&timeout=120s"
65               port: {{ .Values.service.internalPort }}
66               scheme: HTTP
67             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
68             periodSeconds: {{ .Values.readiness.periodSeconds }}
69           env:
70           - name: ENVNAME
71             value: {{ .Values.global.env.name }}
72           - name: HOST_IP
73             valueFrom:
74               fieldRef:
75                 fieldPath: status.podIP
76           - name: ES_HEAP_SIZE
77             value: {{ .Values.config.elasticHeapSize }}
78           volumeMounts:
79           - name: {{ include "common.fullname" . }}-environments
80             mountPath: /root/chef-solo/environments/
81           - name: {{ include "common.fullname" . }}-localtime
82             mountPath: /etc/localtime
83             readOnly: true
84           - name: {{ include "common.fullname" . }}-logs
85             mountPath: /var/lib/jetty/logs
86           - name: {{ include "common.fullname" . }}-data
87             mountPath: /usr/share/elasticsearch/data/
88           resources:
89 {{ toYaml .Values.resources | indent 12 }}
90         {{- if .Values.nodeSelector }}
91         nodeSelector:
92 {{ toYaml .Values.nodeSelector | indent 10 }}
93         {{- end -}}
94         {{- if .Values.affinity }}
95         affinity:
96 {{ toYaml .Values.affinity | indent 10 }}
97         {{- end }}
98       volumes:
99         - name: {{ include "common.fullname" . }}-localtime
100           hostPath:
101             path: /etc/localtime
102       {{- if .Values.persistence.enabled }}
103         - name: {{ include "common.fullname" . }}-data
104           persistentVolumeClaim:
105             claimName: {{ include "common.fullname" . }}
106       {{- else }}
107           emptyDir: {}
108       {{- end }}
109         - name: {{ include "common.fullname" . }}-environments
110           configMap:
111             name: {{ .Release.Name }}-sdc-environments-configmap
112             defaultMode: 0755
113         - name: {{ include "common.fullname" . }}-logs
114           emptyDir: {}
115       imagePullSecrets:
116       - name: "{{ include "common.namespace" . }}-docker-registry-key"