Merge "[PORTAL] Make PORTAL compatible with Kubernetes v1.17"
[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 # ================================================================================
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: {{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}
42           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43           command:
44             - /root/ready.py
45           args:
46           - --container-name
47           - dcae-cloudify-manager
48           - --container-name
49           - consul-server
50           - --container-name
51           - dcae-inventory-api
52           - "-t"
53           - "45"
54           env:
55           - name: NAMESPACE
56             valueFrom:
57               fieldRef:
58                 apiVersion: v1
59                 fieldPath: metadata.namespace
60         - name: init-tls
61           env:
62           - name: POD_IP
63             valueFrom:
64               fieldRef:
65                 apiVersion: v1
66                 fieldPath: status.podIP
67           - name: aaf_locator_fqdn
68             value: dcae
69           image: {{ .Values.global.tlsRepository }}/{{ .Values.global.tlsImage }}
70           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
71           resources: {}
72           volumeMounts:
73             - mountPath: /opt/app/osaaf
74               name: tls-info
75         - name: init-consul
76           image: {{ .Values.global.consulLoaderRepository }}/{{ .Values.global.consulLoaderImage }}
77           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78           args:
79           - --service
80           - "cloudify_manager|dcae-cloudify-manager.{{ include "common.namespace" . }}|443"
81           - --service
82           - "inventory|inventory.{{ include "common.namespace" . }}|8080"
83           - --key
84           - deployment_handler|/dhconfig/config.json
85           resources: {}
86           volumeMounts:
87             - mountPath: /dhconfig
88               name: dh-config
89       containers:
90         - name: {{ include "common.name" . }}
91           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
92           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
93           resources:
94 {{ include "common.resources" . | indent 12 }}
95           ports:
96           - containerPort: {{ .Values.service.internalPort }}
97           # disable liveness probe when breakpoints set in debugger
98           # so K8s doesn't restart unresponsive container
99           {{- if eq .Values.liveness.enabled true }}
100           livenessProbe:
101             tcpSocket:
102               port: {{ .Values.service.internalPort }}
103             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
104             periodSeconds: {{ .Values.liveness.periodSeconds }}
105           {{ end }}
106           readinessProbe:
107             httpGet:
108               path: {{ .Values.readiness.path }}
109               port: {{ .Values.service.internalPort }}
110               scheme: {{ .Values.readiness.scheme }}
111             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
112             periodSeconds: {{ .Values.readiness.periodSeconds }}
113           volumeMounts:
114             - mountPath: /opt/app/dh/log
115               name: component-log
116             - mountPath: /opt/app/dh/etc/cert/
117               name: tls-info
118           env:
119             - name: CONSUL_HOST
120               value: consul-server.{{ include "common.namespace" . }}
121             - name: CLOUDIFY_USER
122               value: admin
123             - name: CLOUDIFY_PASSWORD
124               value: admin
125             - name: CONFIG_BINDING_SERVICE
126               value: config-binding-service
127             - name: NODE_EXTRA_CA_CERTS
128               value: /opt/app/dh/etc/cert/cacert.pem
129             - name: POD_IP
130               valueFrom:
131                 fieldRef:
132                   apiVersion: v1
133                   fieldPath: status.podIP
134         - name: {{ include "common.name" . }}-filebeat
135           env:
136             - name: POD_IP
137               valueFrom:
138                 fieldRef:
139                   apiVersion: v1
140                   fieldPath: status.podIP
141           image: {{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}
142           imagePullPolicy: IfNotPresent
143           resources: {}
144           volumeMounts:
145           - mountPath: /var/log/onap/deployment-handler
146             name: component-log
147           - mountPath: /usr/share/filebeat/data
148             name: filebeat-data
149           - mountPath: /usr/share/filebeat/filebeat.yml
150             name: filebeat-conf
151             subPath: filebeat.yml
152       volumes:
153         - emptyDir: {}
154           name: component-log
155         - emptyDir: {}
156           name: filebeat-data
157         - configMap:
158             defaultMode: 420
159             name: {{ include "common.fullname" . }}-filebeat-configmap
160           name: filebeat-conf
161         - emptyDir: {}
162           name: tls-info
163         - configMap:
164             defaultMode: 422
165             name: {{ include "common.fullname" . }}-configmap
166           name: dh-config
167       imagePullSecrets:
168       - name: "{{ include "common.namespace" . }}-docker-registry-key"