[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / dcaegen2 / components / dcae-policy-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: {{ 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           - dcae-deployment-handler
48           - --container-name
49           - consul-server
50           - --container-name
51           - policy-xacml-pdp
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           - --key
80           - policy_handler|/phconfig/config.json
81           resources: {}
82           volumeMounts:
83             - mountPath: /phconfig
84               name: ph-config
85       containers:
86         - name: {{ include "common.name" . }}
87           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
88           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
89           resources:
90 {{ include "common.resources" . | indent 12 }}
91           ports:
92           - containerPort: {{ .Values.service.internalPort }}
93           # disable liveness probe when breakpoints set in debugger
94           # so K8s doesn't restart unresponsive container
95           {{- if eq .Values.liveness.enabled true }}
96           livenessProbe:
97             tcpSocket:
98               port: {{ .Values.service.internalPort }}
99             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
100             periodSeconds: {{ .Values.liveness.periodSeconds }}
101           {{ end }}
102           readinessProbe:
103             httpGet:
104               path: {{ .Values.readiness.path }}
105               port: {{ .Values.service.internalPort }}
106               scheme: {{ .Values.readiness.scheme }}
107             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
108             periodSeconds: {{ .Values.readiness.periodSeconds }}
109           volumeMounts:
110             - mountPath: /opt/app/policy_handler/logs
111               name: component-log
112             - mountPath: /opt/app/policy_handler/etc/tls/certs/
113               name: tls-info
114           env:
115             - name: CONSUL_HOST
116               value: consul-server.{{ include "common.namespace" . }}
117             - name: CLOUDIFY_USER
118               value: admin
119             - name: CLOUDIFY_PASSWORD
120               value: admin
121             - name: CONFIG_BINDING_SERVICE
122               value: config-binding-service
123             - name: POD_IP
124               valueFrom:
125                 fieldRef:
126                   apiVersion: v1
127                   fieldPath: status.podIP
128         - name: {{ include "common.name" . }}-filebeat
129           env:
130             - name: POD_IP
131               valueFrom:
132                 fieldRef:
133                   apiVersion: v1
134                   fieldPath: status.podIP
135           image: {{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}
136           imagePullPolicy: IfNotPresent
137           resources: {}
138           volumeMounts:
139           - mountPath: /var/log/onap/policy-handler
140             name: component-log
141           - mountPath: /usr/share/filebeat/data
142             name: filebeat-data
143           - mountPath: /usr/share/filebeat/filebeat.yml
144             name: filebeat-conf
145             subPath: filebeat.yml
146       volumes:
147         - emptyDir: {}
148           name: component-log
149         - emptyDir: {}
150           name: filebeat-data
151         - configMap:
152             defaultMode: 420
153             name: {{ include "common.fullname" . }}-filebeat-configmap
154           name: filebeat-conf
155         - emptyDir: {}
156           name: tls-info
157         - configMap:
158             defaultMode: 422
159             name: {{ include "common.fullname" . }}-configmap
160           name: ph-config
161       imagePullSecrets:
162       - name: "{{ include "common.namespace" . }}-docker-registry-key"