Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / sdc / components / sdc-be / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, AT&T, Bell Canada
3 # Modifications Copyright © 2018 ZTE
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 */}}
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
21 spec:
22   selector: {{- include "common.selectors" . | nindent 4 }}
23   replicas: {{ .Values.replicaCount }}
24   template:
25     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
26     spec:
27       initContainers:
28       - name: {{ include "common.name" . }}-readiness
29         command:
30         - /app/ready.py
31         args:
32         - --service-name
33         - sdc-onboarding-be
34         {{- if not .Values.global.kafka.useKafka }}
35         - --service-name
36         - message-router
37         {{- end }}
38         env:
39         - name: NAMESPACE
40           valueFrom:
41             fieldRef:
42               apiVersion: v1
43               fieldPath: metadata.namespace
44         image: {{ include "repositoryGenerator.image.readiness" . }}
45         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
46         resources:
47           limits:
48             cpu: "100m"
49             memory: "500Mi"
50           requests:
51             cpu: "3m"
52             memory: "20Mi"
53       - name: {{ include "common.name" . }}-job-completion
54         image: {{ include "repositoryGenerator.image.readiness" . }}
55         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
56         command:
57         - /app/ready.py
58         args:
59         - --job-name
60         - {{ include "common.release" . }}-sdc-onboarding-be
61         env:
62         - name: NAMESPACE
63           valueFrom:
64             fieldRef:
65               apiVersion: v1
66               fieldPath: metadata.namespace
67         resources:
68           limits:
69             cpu: "100m"
70             memory: "500Mi"
71           requests:
72             cpu: "3m"
73             memory: "20Mi"
74       containers:
75         - name: {{ include "common.name" . }}
76           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
77           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78           ports: {{ include "common.containerPorts" . | nindent 12  }}
79           {{ if eq .Values.liveness.enabled true }}
80           livenessProbe:
81             httpGet:
82               path: /sdc2/rest/healthCheck
83               port: {{ .Values.service.internalPort }}
84             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
85             periodSeconds: {{ .Values.liveness.periodSeconds }}
86             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
87             successThreshold: {{ .Values.liveness.successThreshold }}
88             failureThreshold: {{ .Values.liveness.failureThreshold }}
89           {{ end }}
90           readinessProbe:
91             httpGet:
92               path: /sdc2/rest/healthCheck
93               port: {{ .Values.service.internalPort }}
94             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
95             periodSeconds: {{ .Values.readiness.periodSeconds }}
96             timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
97             successThreshold: {{ .Values.readiness.successThreshold }}
98             failureThreshold: {{ .Values.readiness.failureThreshold }}
99           startupProbe:
100             httpGet:
101               path: /sdc2/rest/healthCheck
102               port: {{ .Values.service.internalPort }}
103             initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
104             periodSeconds: {{ .Values.startup.periodSeconds }}
105             timeoutSeconds: {{ .Values.startup.timeoutSeconds }}
106             successThreshold: {{ .Values.startup.successThreshold }}
107             failureThreshold: {{ .Values.startup.failureThreshold }}
108           resources: {{ include "common.resources" . | nindent 12 }}
109           env:
110           - name: ENVNAME
111             value: {{ .Values.env.name }}
112           - name: JAVA_OPTIONS
113             value: {{ .Values.config.javaOptions }}
114           - name: cassandra_ssl_enabled
115             value: {{ .Values.config.cassandraSslEnabled | quote }}
116           - name: HOST_IP
117             valueFrom:
118               fieldRef:
119                 fieldPath: status.podIP
120           {{- if .Values.global.kafka.useKafka }}
121           - name: SASL_JAAS_CONFIG
122             valueFrom:
123               secretKeyRef:
124                 name: {{ include "common.name" . }}-ku
125                 key: sasl.jaas.config
126           - name: USE_KAFKA
127             value: {{ .Values.global.kafka.useKafka | quote }}
128           {{- end }}
129           volumeMounts:
130           - name: sdc-environments
131             mountPath: /app/jetty/chef-solo/environments/
132           - name: logs
133             mountPath: /var/log/onap
134           - name: logback
135             mountPath: /tmp/logback.xml
136             subPath: logback.xml
137           lifecycle:
138             postStart:
139               exec:
140                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/app/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"]
141         # side car containers
142         {{ include "common.log.sidecar" . | nindent 8 }}
143       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
144       volumes:
145       {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
146       - name: logback
147         configMap:
148           name : {{ include "common.fullname" . }}-logging-configmap
149       - name: sdc-environments
150         configMap:
151           name: {{ include "common.release" . }}-sdc-environments-configmap
152           defaultMode: 0755
153       - name: logs
154         emptyDir: {}
155       {{- include "common.imagePullSecrets" . | nindent 6 }}