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