standardizing SDC helm charts
[oom.git] / kubernetes / sdc / charts / sdc-be / templates / deployment.yaml
1 apiVersion: extensions/v1beta1
2 kind: Deployment
3 metadata:
4   name: {{ include "common.fullname" . }}
5   namespace: {{ include "common.namespace" . }}
6   labels:
7     app: {{ include "common.name" . }}
8     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
9     release: {{ .Release.Name }}
10     heritage: {{ .Release.Service }}
11 spec:
12   replicas: {{ .Values.replicaCount }}
13   template:
14     metadata:
15       labels:
16         app: {{ include "common.name" . }}
17         release: {{ .Release.Name }}
18     spec:
19       initContainers:
20       - name: {{ include "common.name" . }}-readiness
21         command:
22         - /root/ready.py
23         args:
24         - --container-name
25         - "sdc-es"
26         - --container-name
27         - "sdc-cs"
28         env:
29         - name: NAMESPACE
30           valueFrom:
31             fieldRef:
32               apiVersion: v1
33               fieldPath: metadata.namespace
34         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
35         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
36 #      - name: {{ include "common.name" . }}-job-completion
37 #        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
38 #        imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
39 #        command:
40 #        - python
41 #        args:
42 #        - /root/readiness/sdc_check_job_completion.py
43 #        - --job-name
44 #        - sdc-config-cassandra
45 #        env:
46 #        - name: NAMESPACE
47 #          valueFrom:
48 #            fieldRef:
49 #              apiVersion: v1
50 #              fieldPath: metadata.namespace
51 #        volumeMounts:
52 #        - mountPath: /root/readiness
53 #          name: sdc-check-job-completion
54       containers:
55         - name: {{ include "common.name" . }}
56           image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
57           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58           ports:
59           - containerPort: {{ .Values.service.internalPort }}
60           - containerPort: {{ .Values.service.internalPort1 }}
61           # disable liveness probe when breakpoints set in debugger
62           # so K8s doesn't restart unresponsive container
63           {{- if eq .Values.liveness.enabled true }}
64           livenessProbe:
65             tcpSocket:
66               port: {{ .Values.service.internalPort }}
67             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
68             periodSeconds: {{ .Values.liveness.periodSeconds }}
69           {{ end -}}
70           readinessProbe:
71             tcpSocket:
72               port: {{ .Values.service.internalPort }}
73             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
74             periodSeconds: {{ .Values.readiness.periodSeconds }}
75           env:
76           - name: ENVNAME
77             value: {{ .Values.global.env.name }}
78           - name: HOST_IP
79             valueFrom:
80               fieldRef:
81                 fieldPath: status.podIP
82           volumeMounts:
83 #          - name: sdc-sdc-es-es
84 #            mountPath: /usr/share/elasticsearch/data/
85           - name: {{ .Release.Name }}-sdc-environments-configmap
86             mountPath: /root/chef-solo/environments/
87           - name: {{ include "common.fullname" . }}-localtime
88             mountPath: /etc/localtime
89             readOnly: true
90           - name: {{ include "common.fullname" . }}-logs
91             mountPath: /var/lib/jetty/logs
92           - name: {{ include "common.fullname" . }}-logs-2
93             mountPath: /var/log/onap
94           - name: {{ include "common.fullname" . }}-logback
95             mountPath: /tmp/logback.xml
96           lifecycle:
97             postStart:
98               exec:
99                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/var/lib/jetty/config/catalog-be/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
100           resources:
101 {{ toYaml .Values.resources | indent 12 }}
102         {{- if .Values.nodeSelector }}
103         nodeSelector:
104 {{ toYaml .Values.nodeSelector | indent 10 }}
105         {{- end -}}
106         {{- if .Values.affinity }}
107         affinity:
108 {{ toYaml .Values.affinity | indent 10 }}
109         {{- end }}
110
111         # side car containers
112         - name: {{ include "common.name" . }}-filebeat-onap
113           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
114           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
115           volumeMounts:
116           - name: {{ include "common.fullname" . }}-filebeat-conf
117             mountPath: /usr/share/filebeat/filebeat.yml
118             subPath: filebeat.yml
119           - name: {{ include "common.fullname" . }}-logs-2
120             mountPath: /var/log/onap
121           - name: {{ include "common.fullname" . }}-data-filebeat
122             mountPath: /usr/share/filebeat/data
123       volumes:
124         - name: {{ include "common.fullname" . }}-localtime
125           hostPath:
126             path: /etc/localtime
127         - name: {{ include "common.fullname" . }}-filebeat-conf
128           configMap:
129            name: {{ include "common.fullname" . }}-filebeat-configmap
130         - name: {{ include "common.fullname" . }}-logs-2
131           emptyDir: {}
132         - name: {{ include "common.fullname" . }}-data-filebeat
133           emptyDir: {}
134         - name: {{ include "common.fullname" . }}-logback
135           configMap:
136             name : {{ include "common.fullname" . }}-log-be-configmap
137 #        - name: sdc-sdc-es-es
138 #          hostPath:
139 #            path: {{ .Values.dataRootDir }}/{{ .Values.nsPrefix }}/sdc/sdc-es/ES
140 #        - name: sdc-environments
141           configMap:
142             name: {{ include "common.fullname" . }}-environments-configmap
143             defaultMode: 0755
144         - name:  {{ include "common.fullname" . }}-logs
145           hostPath:
146             path:  {{ .Values.dataRootDir }}/{{ include "common.namespace" . }}/sdc/logs
147       imagePullSecrets:
148       - name: "{{ include "common.namespace" . }}-docker-registry-key"