f294abf14e1524b288220e2230ca148921d2b869
[oom.git] / kubernetes / modeling / charts / modeling-etsicatalog / templates / 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 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: {{ include "common.release" . }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ include "common.release" . }}
32       annotations:
33         sidecar.istio.io/inject: "{{.Values.istioSidecar}}"
34     spec:
35       initContainers:
36       - command:
37         - /root/ready.py
38         args:
39         - --container-name
40         - modeling-mariadb
41         env:
42         - name: NAMESPACE
43           valueFrom:
44             fieldRef:
45               apiVersion: v1
46               fieldPath: metadata.namespace
47         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
48         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
49         name: {{ include "common.name" . }}-readiness
50       containers:
51         - name: {{ include "common.name" . }}
52           command:
53             - bash
54           args:
55             - -c
56             - 'MYSQL_AUTH=root:${MYSQL_ROOT_PASSWORD} ./docker-entrypoint.sh'
57           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
58           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
59           ports:
60           - containerPort: {{ .Values.service.internalPort }}
61           # disable liveness probe when breakpoints set in debugger
62           # so K8s doesn't restart unresponsive container
63           {{ if .Values.liveness.enabled }}
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: MSB_PROTO
77             value: "{{ .Values.global.config.msbProtocol }}"
78           - name: SSL_ENABLED
79             value: "{{ .Values.global.config.ssl_enabled }}"
80           - name: MSB_ADDR
81             value: "{{ .Values.global.config.msbServiceName }}:{{ .Values.global.config.msbPort }}"
82           - name: MYSQL_ADDR
83             value: {{ (index .Values "mariadb-galera" "service" "name") }}:{{ (index .Values "mariadb-galera" "service" "internalPort") }}
84           - name: MYSQL_ROOT_PASSWORD
85             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-pass" "key" "password") | indent 12}}
86           volumeMounts:
87           - name: {{ include "common.fullname" . }}-etsicatalog
88             mountPath: /service/modeling/etsicatalog/static
89           - name: {{ include "common.fullname" . }}-localtime
90             mountPath: /etc/localtime
91             readOnly: true
92           - name: {{ include "common.fullname" . }}-logs
93             mountPath: /var/log/onap
94           - name: {{ include "common.fullname" . }}-logconfig
95             mountPath: /opt/modeling/etsicatalog/config/log.yml
96             subPath: log.yml
97           resources:
98 {{ include "common.resources" . | indent 12 }}
99         {{- if .Values.nodeSelector }}
100         nodeSelector:
101 {{ toYaml .Values.nodeSelector | indent 10 }}
102         {{- end -}}
103         {{- if .Values.affinity }}
104         affinity:
105 {{ toYaml .Values.affinity | indent 10 }}
106         {{- end }}
107
108         # side car containers
109         - name: {{ include "common.name" . }}-filebeat-onap
110           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
111           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
112           volumeMounts:
113           - name: {{ include "common.fullname" . }}-filebeat-conf
114             mountPath: /usr/share/filebeat/filebeat.yml
115             subPath: filebeat.yml
116           - name: {{ include "common.fullname" . }}-logs
117             mountPath: /var/log/onap
118           - name: {{ include "common.fullname" . }}-data-filebeat
119             mountPath: /usr/share/filebeat/data
120
121       volumes:
122         - name: {{ include "common.fullname" . }}-etsicatalog
123         {{- if .Values.persistence.enabled }}
124           persistentVolumeClaim:
125             claimName: {{ include "common.fullname" . }}
126         {{- else }}
127           emptyDir: {}
128         {{- end }}
129         - name: {{ include "common.fullname" . }}-localtime
130           hostPath:
131             path: /etc/localtime
132         - name:  {{ include "common.fullname" . }}-logs
133           emptyDir: {}
134         - name: {{ include "common.fullname" . }}-logconfig
135           configMap:
136             name : {{ include "common.fullname" . }}-logging-configmap
137
138         - name: {{ include "common.fullname" . }}-filebeat-conf
139           configMap:
140             name: {{ include "common.release" . }}-modeling-filebeat-configmap
141         - name: {{ include "common.fullname" . }}-data-filebeat
142           emptyDir: {}
143       imagePullSecrets:
144       - name: "{{ include "common.namespace" . }}-docker-registry-key"