[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / dcaegen2 / components / dcae-config-binding-service / templates / deployment.yaml
1 #============LICENSE_START========================================================
2 # ================================================================================
3 # Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ============LICENSE_END=========================================================
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   replicas: 1
30   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   template:
34     metadata:
35       labels:
36         app: {{ include "common.name" . }}
37         release: {{ include "common.release" . }}
38     spec:
39       initContainers:
40         - name: {{ include "common.name" . }}-readiness
41           image: {{ include "common.repository" . }}/{{ .Values.global.readinessImage }}
42           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43           command:
44             - /app/ready.py
45           args:
46             - --container-name
47             - consul-server
48             - --container-name
49             - aaf-cm
50             - "-t"
51             - "15"
52           env:
53           - name: NAMESPACE
54             valueFrom:
55               fieldRef:
56                 apiVersion: v1
57                 fieldPath: metadata.namespace
58           - name: aaf_locator_fqdn
59             value: dcae
60         {{- if .Values.service.secure.enabled }}
61         - name: init-tls
62           env:
63           - name: POD_IP
64             valueFrom:
65               fieldRef:
66                 apiVersion: v1
67                 fieldPath: status.podIP
68           image: {{ .Values.global.tlsRepository }}/{{ .Values.global.tlsImage }}
69           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
70           resources: {}
71           volumeMounts:
72             - mountPath: /opt/app/osaaf
73               name: tls-info
74         {{ end  }}
75       containers:
76         {{- if .Values.service.secure.enabled }}
77         - name: {{ include "common.name" . }}
78           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
79           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
80           resources:
81 {{ include "common.resources" . | indent 12 }}
82           ports:
83           - containerPort: {{ .Values.service.secure.internalPort }}
84           # disable liveness probe when breakpoints set in debugger
85           # so K8s doesn't restart unresponsive container
86           {{- if eq .Values.liveness.enabled true }}
87           livenessProbe:
88             tcpSocket:
89               port: {{ .Values.service.secure.internalPort }}
90             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
91             periodSeconds: {{ .Values.liveness.periodSeconds }}
92           {{ end -}}
93           readinessProbe:
94             httpGet:
95               scheme: "HTTPS"
96               path: {{ .Values.readiness.path }}
97               port: {{ .Values.service.secure.internalPort }}
98             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
99             periodSeconds: {{ .Values.readiness.periodSeconds }}
100           volumeMounts:
101           - name: {{ include "common.fullname" . }}-logs
102             mountPath: /opt/logs
103           - name: tls-info
104             mountPath: /opt/tls
105           env:
106             - name: CONSUL_HOST
107               value: consul.{{ include "common.namespace" . }}
108             - name: USE_HTTPS
109               value: "1"
110             - name: HTTPS_CERT_PATH
111               value: "/opt/tls/cert.pem"
112             - name: HTTPS_KEY_PATH
113               value: "/opt/tls/key.pem"
114         - name: {{ include "common.name" . }}-fb-onap
115           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
116           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
117           volumeMounts:
118           - name: {{ include "common.fullname" . }}-fb-conf
119             mountPath: /usr/share/filebeat/filebeat.yml
120             subPath: filebeat.yml
121           - name: {{ include "common.fullname" . }}-data-fb
122             mountPath: /usr/share/filebeat/data
123           - name: {{ include "common.fullname" . }}-logs
124             mountPath: /var/log/onap/config-binding-service
125         {{ end }}
126         {{- if .Values.service.insecure.enabled }}
127         - name: {{ include "common.name" . }}-insecure
128           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
129           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
130           resources:
131 {{ include "common.resources" . | indent 12 }}
132           ports:
133           - containerPort: {{ .Values.service.insecure.internalPort }}
134           # disable liveness probe when breakpoints set in debugger
135           # so K8s doesn't restart unresponsive container
136           {{- if eq .Values.liveness.enabled true }}
137           livenessProbe:
138             tcpSocket:
139               port: {{ .Values.service.insecure.internalPort }}
140             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
141             periodSeconds: {{ .Values.liveness.periodSeconds }}
142           {{ end -}}
143           readinessProbe:
144             httpGet:
145               scheme: "HTTP"
146               path: {{ .Values.readiness.path }}
147               port: {{ .Values.service.insecure.internalPort }}
148             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
149             periodSeconds: {{ .Values.readiness.periodSeconds }}
150           volumeMounts:
151           - name: {{ include "common.fullname" . }}-logs-i
152             mountPath: /opt/logs
153           env:
154             - name: CONSUL_HOST
155               value: consul.{{ include "common.namespace" . }}
156         - name: {{ include "common.name" . }}-fb-onap-i
157           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
158           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
159           volumeMounts:
160           - name: {{ include "common.fullname" . }}-fb-conf
161             mountPath: /usr/share/filebeat/filebeat.yml
162             subPath: filebeat.yml
163           - name: {{ include "common.fullname" . }}-data-fb-i
164             mountPath: /usr/share/filebeat/data
165           - name: {{ include "common.fullname" . }}-logs-i
166             mountPath: /var/log/onap/config-binding-service
167         {{ end }}
168       volumes:
169         - name: {{ include "common.fullname" . }}-fb-conf
170           configMap:
171             name: {{ include "common.release" . }}-cbs-filebeat-configmap
172         {{- if .Values.service.secure.enabled }}
173         - name: {{ include "common.fullname" . }}-data-fb
174           emptyDir: {}
175         - name:  {{ include "common.fullname" . }}-logs
176           emptyDir: {}
177         - name: tls-info
178           emptyDir: {}
179         {{ end }}
180         {{- if .Values.service.insecure.enabled }}
181         - name: {{ include "common.fullname" . }}-data-fb-i
182           emptyDir: {}
183         - name:  {{ include "common.fullname" . }}-logs-i
184           emptyDir: {}
185         {{ end }}
186
187       imagePullSecrets:
188       - name: "{{ include "common.namespace" . }}-docker-registry-key"