[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / sdc / charts / sdc-wfd-be / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, AT&T, Bell Canada
2 # Modifications Copyright © 2018  ZTE
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 apiVersion: apps/v1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   replicas: {{ .Values.replicaCount }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ include "common.release" . }}
36     spec:
37       initContainers:
38       {{- if .Values.initJob.enabled }}
39       - name: {{ include "common.name" . }}-job-completion
40         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
41         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
42         command:
43         - /app/ready.py
44         args:
45         - --job-name
46         - {{ include "common.fullname" . }}-workflow-init
47         env:
48         - name: NAMESPACE
49           valueFrom:
50             fieldRef:
51               apiVersion: v1
52               fieldPath: metadata.namespace
53       {{ end }}
54       containers:
55         - name: {{ include "common.name" . }}
56           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
57           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58           ports:
59           - containerPort: {{ template "wfd-be.internalPort" . }}
60           # disable liveness probe when breakpoints set in debugger
61           # so K8s doesn't restart unresponsive container
62           {{ if .Values.liveness.enabled }}
63           livenessProbe:
64             tcpSocket:
65               port: {{ template "wfd-be.internalPort" . }}
66             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
67             periodSeconds: {{ .Values.liveness.periodSeconds }}
68           {{ end }}
69           readinessProbe:
70             tcpSocket:
71               port: {{ template "wfd-be.internalPort" . }}
72             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
73             periodSeconds: {{ .Values.readiness.periodSeconds }}
74           env:
75           - name: JAVA_OPTIONS
76             value: {{ .Values.config.javaOptions }}
77           - name: CS_HOSTS
78             value: "{{ .Values.global.cassandra.serviceName }}"
79           - name: CS_PORT
80             value: "{{ .Values.config.cassandraClientPort }}"
81           - name: CS_AUTHENTICATE
82             value: "{{ .Values.config.cassandraAuthenticationEnabled }}"
83           - name: CS_USER
84             valueFrom:
85               secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_user}
86           - name: CS_PASSWORD
87             valueFrom:
88               secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: sdc_password}
89           - name: CS_SSL_ENABLED
90             value: "{{ .Values.config.cassandraSSLEnabled }}"
91           - name: CS_TRUST_STORE_PATH
92             value: "{{ .Values.config.cassandraTrustStorePath }}"
93           - name: CS_TRUST_STORE_PASSWORD
94             valueFrom:
95               secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: cs_truststore_password}
96           - name: SDC_PROTOCOL
97             value: "{{ .Values.config.sdcProtocol }}"
98           - name: SDC_ENDPOINT
99             value: "{{ .Values.config.sdcEndpoint }}"
100           - name: SDC_USER
101             value: "{{ .Values.config.sdcExternalUser }}"
102           - name: SDC_PASSWORD
103             valueFrom:
104               secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: wf_external_user_password}
105           - name: SERVER_SSL_ENABLED
106             value: "{{ .Values.config.serverSSLEnabled }}"
107           - name: SERVER_SSL_KEYSTORE_TYPE
108             value: "{{ .Values.config.serverSSLKeyStoreType }}"
109           - name: SERVER_SSL_KEYSTORE_PATH
110             value: "{{ .Values.config.serverSSLKeyStorePath }}"
111           - name: SERVER_SSL_KEY_PASSWORD
112             valueFrom:
113               secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: keystore_password}
114           - name: SERVER_SSL_TRUSTSTORE_TYPE
115             value: "{{ .Values.config.serverSSLTrustStoreType }}"
116           - name: SERVER_SSL_TRUSTSTORE_PATH
117             value: "{{ .Values.config.serverSSLTrustStorePath }}"
118           - name: SERVER_SSL_TRUST_PASSWORD
119             valueFrom:
120               secretKeyRef: {name: {{ include "common.release" . }}-sdc-cs-secrets, key: truststore_password}
121           volumeMounts:
122           - name: sdc-cert
123             mountPath: /keystore
124             subPath: org.onap.sdc.p12
125           - name: sdc-cert
126             mountPath: /truststore
127             subPath: org.onap.sdc.trust.jks
128       volumes:
129         - name: sdc-cert
130           secret:
131             secretName: sdc-cert
132       imagePullSecrets:
133       - name: "{{ include "common.namespace" . }}-docker-registry-key"