[GENERAL] Use readiness container v3.0.1
[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: apps/v1
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: {{ include "common.release" . }}
24     heritage: {{ .Release.Service }}
25 spec:
26   selector:
27     matchLabels:
28       app: {{ include "common.name" . }}
29   replicas: {{ .Values.replicaCount }}
30   template:
31     metadata:
32       labels:
33         app: {{ include "common.name" . }}
34         release: {{ include "common.release" . }}
35     spec:
36       initContainers:
37       - name: {{ include "common.name" . }}-readiness
38         command:
39         - /app/ready.py
40         args:
41         - --container-name
42         - "sdc-wfd-be"
43         env:
44         - name: NAMESPACE
45           valueFrom:
46             fieldRef:
47               apiVersion: v1
48               fieldPath: metadata.namespace
49         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
50         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
51       containers:
52         - name: {{ include "common.name" . }}
53           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
54           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55           ports:
56           - containerPort: {{ template "wfd-fe.internalPort" . }}
57           {{ if .Values.liveness.enabled }}
58           livenessProbe:
59             tcpSocket:
60               port: {{ template "wfd-fe.internalPort" . }}
61             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
62             periodSeconds: {{ .Values.liveness.periodSeconds }}
63           {{ end }}
64           readinessProbe:
65             tcpSocket:
66               port: {{ template "wfd-fe.internalPort" . }}
67             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
68             periodSeconds: {{ .Values.readiness.periodSeconds }}
69           env:
70           - name: ENVNAME
71             value: {{ .Values.global.env.name }}
72           - name: JAVA_OPTIONS
73             value: {{ .Values.config.javaOptions }}
74           - name: BACKEND
75             value: {{ .Values.config.backendServerURL }}
76           - name: IS_HTTPS
77             value: "{{ .Values.config.isHttpsEnabled}}"
78             {{ if and .Values.config.isHttpsEnabled (eq .Values.security.isDefaultStore false) }}
79           - name: KEYSTORE_PASS
80             valueFrom:
81               secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: keystore_password}
82           - name: TRUSTSTORE_PASS
83             valueFrom:
84               secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: truststore_password}
85           - name: TRUSTSTORE_PATH
86             value: "{{ .Values.security.storePath }}/{{ .Values.security.truststoreFilename }}"
87           - name: KEYSTORE_PATH
88             value: "{{ .Values.security.storePath }}/{{ .Values.security.keystoreFilename }}"
89           - name: TRUST_ALL
90             value: "{{ .Values.config.isTrustAll}}"
91             {{ end }}
92           volumeMounts:
93           - name: {{ include "common.fullname" . }}-localtime
94             mountPath: /etc/localtime
95             readOnly: true
96           - name: sdc-cert
97             mountPath: /var/lib/jetty/etc/org.onap.sdc.p12
98             subPath: org.onap.sdc.p12
99           - name: sdc-cert
100             mountPath: /var/lib/jetty/etc/org.onap.sdc.trust.jks
101             subPath: org.onap.sdc.trust.jks
102           resources:
103 {{ include "common.resources" . | indent 12 }}
104         {{- if .Values.nodeSelector }}
105         nodeSelector:
106 {{ toYaml .Values.nodeSelector | indent 10 }}
107         {{- end -}}
108         {{- if .Values.affinity }}
109         affinity:
110 {{ toYaml .Values.affinity | indent 10 }}
111         {{- end }}
112         # side car containers
113         - name: {{ include "common.name" . }}-filebeat-onap
114           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
115           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
116           volumeMounts:
117           - name: {{ include "common.fullname" . }}-filebeat-conf
118             mountPath: /usr/share/filebeat/filebeat.yml
119             subPath: filebeat.yml
120           - name: {{ include "common.fullname" . }}-logs
121             mountPath: /var/log/onap
122           - name: {{ include "common.fullname" . }}-data-filebeat
123             mountPath: /usr/share/filebeat/data
124       volumes:
125         - name: {{ include "common.fullname" . }}-localtime
126           hostPath:
127             path: /etc/localtime
128         - name: sdc-cert
129           secret:
130             secretName: sdc-cert
131         - name: {{ include "common.fullname" . }}-filebeat-conf
132           configMap:
133             name: {{ include "common.release" . }}-sdc-filebeat-configmap
134         - name: {{ include "common.fullname" . }}-data-filebeat
135           emptyDir: {}
136         - name:  {{ include "common.fullname" . }}-logs
137           emptyDir: {}
138       imagePullSecrets:
139       - name: "{{ include "common.namespace" . }}-docker-registry-key"