Merge "[DCAEMOD] Uses new tpls for repos / images"
[oom.git] / kubernetes / sdc / components / sdc-wfd-fe / templates / deployment.yaml
1 {{/*
2 # Copyright © 2018 Amdocs, Bell Canada
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
16
17 apiVersion: apps/v1
18 kind: Deployment
19 metadata:
20   name: {{ include "common.fullname" . }}
21   namespace: {{ include "common.namespace" . }}
22   labels:
23     app: {{ include "common.name" . }}
24     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
25     release: {{ include "common.release" . }}
26     heritage: {{ .Release.Service }}
27 spec:
28   selector:
29     matchLabels:
30       app: {{ include "common.name" . }}
31   replicas: {{ .Values.replicaCount }}
32   template:
33     metadata:
34       labels:
35         app: {{ include "common.name" . }}
36         release: {{ include "common.release" . }}
37     spec:
38       initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
39       - name: {{ include "common.name" . }}-readiness
40         command:
41         - /app/ready.py
42         args:
43         - --container-name
44         - "sdc-wfd-be"
45         env:
46         - name: NAMESPACE
47           valueFrom:
48             fieldRef:
49               apiVersion: v1
50               fieldPath: metadata.namespace
51         image: {{ include "repositoryGenerator.image.readiness" . }}
52         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53         resources:
54           limits:
55             cpu: 100m
56             memory: 100Mi
57           requests:
58             cpu: 3m
59             memory: 20Mi
60       {{- if .Values.global.aafEnabled }}
61       - name: {{ include "common.fullname" . }}-move-cert
62         command:
63           - /bin/sh
64         args:
65           - -c
66           - |
67             cp {{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.keystoreFile }} /sdc-certs/{{ .Values.certInitializer.keystoreFile }}
68             cp {{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.truststoreFile }} /sdc-certs/{{ .Values.certInitializer.truststoreFile }}
69             cp {{ .Values.certInitializer.credsPath }}/mycreds.prop /sdc-certs/mycreds.prop
70         image: {{ include "repositoryGenerator.image.busybox" . }}
71         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
73           - name: sdc-certs
74             mountPath: /sdc-certs
75         resources:
76           limits:
77             cpu: 100m
78             memory: 100Mi
79           requests:
80             cpu: 3m
81             memory: 20Mi
82       {{- end }}
83       containers:
84         - name: {{ include "common.name" . }}
85           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
86           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
87           {{- if .Values.global.aafEnabled }}
88           command:
89           - sh
90           args:
91           - "-c"
92           - |
93             export $(grep '^c' /sdc-certs/mycreds.prop | xargs -0)
94             export KEYSTORE_PASS=$cadi_keystore_password_p12
95             export TRUSTSTORE_PASS=$cadi_truststore_password
96             export KEYSTORE_PATH=/etc/{{ .Values.certInitializer.keystoreFile }}
97             export TRUSTSTORE_PATH=/etc/{{ .Values.certInitializer.truststoreFile }}
98             ./startup.sh
99           {{- end }}
100           ports:
101           - containerPort: {{ template "wfd-fe.internalPort" . }}
102           {{ if .Values.liveness.enabled }}
103           livenessProbe:
104             tcpSocket:
105               port: {{ template "wfd-fe.internalPort" . }}
106             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
107             periodSeconds: {{ .Values.liveness.periodSeconds }}
108           {{ end }}
109           readinessProbe:
110             tcpSocket:
111               port: {{ template "wfd-fe.internalPort" . }}
112             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
113             periodSeconds: {{ .Values.readiness.periodSeconds }}
114           env:
115           - name: ENVNAME
116             value: {{ .Values.env.name }}
117           - name: JAVA_OPTIONS
118             value: {{ .Values.config.javaOptions }}
119           - name: BACKEND
120             value: {{ .Values.config.backendServerURL }}
121           - name: IS_HTTPS
122             value: "{{ .Values.config.isHttpsEnabled}}"
123             {{ if and .Values.config.isHttpsEnabled (eq .Values.security.isDefaultStore false) }}
124           - name: TRUST_ALL
125             value: "{{ .Values.config.isTrustAll}}"
126             {{ end }}
127           volumeMounts:
128           - name: {{ include "common.fullname" . }}-localtime
129             mountPath: /etc/localtime
130             readOnly: true
131           {{- if .Values.global.aafEnabled }}
132           - name: sdc-certs
133             mountPath: /sdc-certs/mycreds.prop
134             subPath: mycreds.prop
135           - name: sdc-certs
136             mountPath: /var/lib/jetty/etc/{{ .Values.certInitializer.keystoreFile }}
137             subPath: {{ .Values.certInitializer.keystoreFile }}
138           - name: sdc-certs
139             mountPath: /var/lib/jetty/etc/{{ .Values.certInitializer.truststoreFile }}
140             subPath: {{ .Values.certInitializer.truststoreFile }}
141           {{ end }}
142           resources: {{ include "common.resources" . | nindent 12 }}
143         {{- if .Values.nodeSelector }}
144         nodeSelector:
145 {{ toYaml .Values.nodeSelector | indent 10 }}
146         {{- end -}}
147         {{- if .Values.affinity }}
148         affinity:
149 {{ toYaml .Values.affinity | indent 10 }}
150         {{- end }}
151         # side car containers
152         - name: {{ include "common.name" . }}-filebeat-onap
153           image: {{ include "repositoryGenerator.image.logging" . }}
154           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
155           volumeMounts:
156           - name: {{ include "common.fullname" . }}-filebeat-conf
157             mountPath: /usr/share/filebeat/filebeat.yml
158             subPath: filebeat.yml
159           - name: {{ include "common.fullname" . }}-logs
160             mountPath: /var/log/onap
161           - name: {{ include "common.fullname" . }}-data-filebeat
162             mountPath: /usr/share/filebeat/data
163           resources:
164             limits:
165               cpu: 100m
166               memory: 100Mi
167             requests:
168               cpu: 3m
169               memory: 20Mi
170       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
171         - name: {{ include "common.fullname" . }}-localtime
172           hostPath:
173             path: /etc/localtime
174         {{- if .Values.global.aafEnabled }}
175         - name: sdc-certs
176           emptyDir:
177             medium: "Memory"
178         {{- end }}
179         - name: {{ include "common.fullname" . }}-filebeat-conf
180           configMap:
181             name: {{ include "common.release" . }}-sdc-filebeat-configmap
182         - name: {{ include "common.fullname" . }}-data-filebeat
183           emptyDir: {}
184         - name:  {{ include "common.fullname" . }}-logs
185           emptyDir: {}
186       imagePullSecrets:
187       - name: "{{ include "common.namespace" . }}-docker-registry-key"