4227b40a3c90a96f94076854508ed0513cd232a1
[oom.git] / kubernetes / sdc / components / sdc-fe / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018 AT&T, ZTE
4 # Modifications Copyright © 2023 Deutsche Telekom
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-be
37         - "-t"
38         - "35"
39         env:
40         - name: NAMESPACE
41           valueFrom:
42             fieldRef:
43               apiVersion: v1
44               fieldPath: metadata.namespace
45         resources:
46           limits:
47             cpu: "100m"
48             memory: "500Mi"
49           requests:
50             cpu: "3m"
51             memory: "20Mi"
52       containers:
53         - name: {{ include "common.name" . }}
54           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
55           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56           ports: {{ include "common.containerPorts" . | nindent 12  }}
57           {{ if eq .Values.liveness.enabled true }}
58           livenessProbe:
59             tcpSocket:
60               port: {{ .Values.service.internalPort }}
61             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
62             periodSeconds: {{ .Values.liveness.periodSeconds }}
63             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
64             successThreshold: {{ .Values.liveness.successThreshold }}
65             failureThreshold: {{ .Values.liveness.failureThreshold }}
66           {{ end }}
67           readinessProbe:
68             tcpSocket:
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             tcpSocket:
77               port: {{ .Values.service.internalPort }}
78             initialDelaySeconds: {{ .Values.startup.initialDelaySeconds }}
79             periodSeconds: {{ .Values.startup.periodSeconds }}
80             timeoutSeconds: {{ .Values.startup.timeoutSeconds }}
81             successThreshold: {{ .Values.startup.successThreshold }}
82             failureThreshold: {{ .Values.startup.failureThreshold }}
83           resources: {{ include "common.resources" . | nindent 12 }}
84           env:
85           - name: ENVNAME
86             value: {{ .Values.env.name }}
87           - name: HOST_IP
88             valueFrom:
89               fieldRef:
90                 fieldPath: status.podIP
91           - name: JAVA_OPTIONS
92             value: {{ .Values.config.javaOptions }}
93           volumeMounts:
94           - name: sdc-environments
95             mountPath: /app/jetty/chef-solo/environments/
96           - name: localtime
97             mountPath: /etc/localtime
98             readOnly: true
99           - name: logs
100             mountPath: /var/log/onap
101           - name: configs
102             mountPath: /app/jetty/config/catalog-fe/plugins-configuration.yaml
103             subPath: plugins-configuration.yaml
104           - name: logback
105             mountPath: /tmp/logback.xml
106             subPath: logback.xml
107           lifecycle:
108             postStart:
109               exec:
110                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/app/jetty/config/catalog-fe/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
111         # side car containers
112         {{ include "common.log.sidecar" . | nindent 8 }}
113       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
114       volumes:
115         - name: localtime
116           hostPath:
117             path: /etc/localtime
118         {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 8 }}
119         - name: configs
120           configMap:
121             name : {{ include "common.fullname" . }}-plugins-configmap
122             defaultMode: 0777
123         - name: logback
124           configMap:
125             name : {{ include "common.fullname" . }}-logging-configmap
126         - name: sdc-environments
127         {{- if .Values.global.aafEnabled }}
128           emptyDir: { medium: "Memory" }
129         - name: sdc-environments-input
130         {{- end }}
131           configMap:
132             name: {{ include "common.release" . }}-sdc-environments-configmap
133             defaultMode: 0755
134         - name: logs
135           emptyDir: {}
136       {{- include "common.imagePullSecrets" . | nindent 6 }}