0be06f398546c866277be403769facd0733da93a
[oom.git] / kubernetes / sdc / charts / sdc-wfd-fe / templates / deployment.yaml
1 # Copyright © 2018 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: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
32     spec:
33       initContainers:
34       - name: {{ include "common.name" . }}-readiness
35         command:
36         - /root/ready.py
37         args:
38         - --container-name
39         - "sdc-wfd-be"
40         env:
41         - name: NAMESPACE
42           valueFrom:
43             fieldRef:
44               apiVersion: v1
45               fieldPath: metadata.namespace
46         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
47         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
48       containers:
49         - name: {{ include "common.name" . }}
50           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           ports:
53           - containerPort: {{ .Values.service.internalPort }}
54           - containerPort: {{ .Values.service.internalPort2 }}
55           {{ if .Values.liveness.enabled }}
56           livenessProbe:
57             tcpSocket:
58               port: {{ .Values.service.internalPort }}
59             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
60             periodSeconds: {{ .Values.liveness.periodSeconds }}
61           {{ end }}
62           readinessProbe:
63             tcpSocket:
64               port: {{ .Values.service.internalPort }}
65             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
66             periodSeconds: {{ .Values.readiness.periodSeconds }}
67           env:
68           - name: ENVNAME
69             value: {{ .Values.global.env.name }}
70           - name: JAVA_OPTIONS
71             value: {{ .Values.config.javaOptions }}
72           - name: BACKEND
73             value: {{ .Values.config.backendServerURL }}
74           - name: IS_HTTPS
75             value: "{{ .Values.config.isHttpsEnabled}}"
76             {{ if and .Values.config.isHttpsEnabled (eq .Values.security.isDefaultStore false) }}
77           - name: KEYSTORE_PASS
78             {{- if .Values.global.security.keysFromCa }}
79             valueFrom:
80               secretKeyRef:
81                 name: mft-sdc
82                 key: keystore-password.txt
83             {{ else }}
84             value: {{ .Values.global.security.keyStorePass}}
85             {{- end }}
86           - name: TRUSTSTORE_PASS
87             {{- if .Values.global.security.keysFromCa }}
88             valueFrom:
89               secretKeyRef:
90                 name: mft-catruststore
91                 key: keystore-password.txt
92             {{ else }}
93             value: {{ .Values.global.security.trustStorePass}}
94             {{- end }}
95           - name: TRUSTSTORE_PATH
96             value: "{{ .Values.security.storePath }}/{{ .Values.security.truststoreFilename }}"
97           - name: KEYSTORE_PATH
98             value: "{{ .Values.security.storePath }}/{{ .Values.security.keystoreFilename }}"
99           - name: TRUSTSTORE_TYPE
100             value: {{ .Values.security.truststore.type }}
101           - name: KEYSTORE_TYPE
102             value: {{ .Values.security.keystore.type }}
103             {{ end }}
104           volumeMounts:
105           {{ if and .Values.config.isHttpsEnabled (eq .Values.security.isDefaultStore false) }}
106           - name: {{ include "common.fullname" . }}-jetty-https-truststore
107             mountPath: /var/lib/jetty/{{ .Values.security.storePath }}/{{ .Values.security.truststoreFilename }}
108             subPath: {{ .Values.security.truststoreFilename }}
109           - name: {{ include "common.fullname" . }}-jetty-https-keystore
110             mountPath: /var/lib/jetty/etc/{{ .Values.security.storePath }}/{{ .Values.security.keystoreFilename }}
111             subPath: {{ .Values.security.keystoreFilename }}
112           {{ end }}
113           - name: {{ include "common.fullname" . }}-localtime
114             mountPath: /etc/localtime
115             readOnly: true
116           resources:
117 {{ include "common.resources" . | indent 12 }}
118         {{- if .Values.nodeSelector }}
119         nodeSelector:
120 {{ toYaml .Values.nodeSelector | indent 10 }}
121         {{- end -}}
122         {{- if .Values.affinity }}
123         affinity:
124 {{ toYaml .Values.affinity | indent 10 }}
125         {{- end }}
126
127         # side car containers
128         - name: {{ include "common.name" . }}-filebeat-onap
129           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
130           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
131           volumeMounts:
132           - name: {{ include "common.fullname" . }}-filebeat-conf
133             mountPath: /usr/share/filebeat/filebeat.yml
134             subPath: filebeat.yml
135           - name: {{ include "common.fullname" . }}-logs
136             mountPath: /var/log/onap
137           - name: {{ include "common.fullname" . }}-data-filebeat
138             mountPath: /usr/share/filebeat/data
139       volumes:
140         - name: {{ include "common.fullname" . }}-localtime
141           hostPath:
142             path: /etc/localtime
143         - name: {{ include "common.fullname" . }}-filebeat-conf
144           configMap:
145             name: {{ .Release.Name }}-sdc-filebeat-configmap
146         - name: {{ include "common.fullname" . }}-data-filebeat
147           emptyDir: {}
148         - name:  {{ include "common.fullname" . }}-logs
149           emptyDir: {}
150       imagePullSecrets:
151       - name: "{{ include "common.namespace" . }}-docker-registry-key"