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