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