c7e1d70030e623618d3fc706af6432a8b29bc270
[oom.git] / kubernetes / dcaegen2 / components / dcae-config-binding-service / templates / deployment.yaml
1 {{/*
2 #============LICENSE_START========================================================
3 # ================================================================================
4 # Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
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
20 apiVersion: apps/v1
21 kind: Deployment
22 metadata:
23   name: {{ include "common.fullname" . }}
24   namespace: {{ include "common.namespace" . }}
25   labels:
26     app: {{ include "common.name" . }}
27     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
28     release: {{ include "common.release" . }}
29     heritage: {{ .Release.Service }}
30 spec:
31   replicas: 1
32   selector:
33     matchLabels:
34       app: {{ include "common.name" . }}
35   template:
36     metadata:
37       labels:
38         app: {{ include "common.name" . }}
39         release: {{ include "common.release" . }}
40     spec:
41       initContainers:
42         - name: {{ include "common.name" . }}-readiness
43           image: {{ include "repositoryGenerator.image.readiness" . }}
44           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
45           command:
46             - /app/ready.py
47           args:
48             - --container-name
49             - consul-server
50             - --container-name
51             - aaf-cm
52             - "-t"
53             - "15"
54           env:
55           - name: NAMESPACE
56             valueFrom:
57               fieldRef:
58                 apiVersion: v1
59                 fieldPath: metadata.namespace
60           - name: aaf_locator_fqdn
61             value: dcae
62         {{- if .Values.service.secure.enabled }}
63         - name: init-tls
64           env:
65           - name: POD_IP
66             valueFrom:
67               fieldRef:
68                 apiVersion: v1
69                 fieldPath: status.podIP
70           image: {{ include "repositoryGenerator.repository" . }}/{{ .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         {{ end  }}
77       containers:
78         {{- if .Values.service.secure.enabled }}
79         - name: {{ include "common.name" . }}
80           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
81           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
82           resources:
83 {{ include "common.resources" . | indent 12 }}
84           ports:
85           - containerPort: {{ .Values.service.secure.internalPort }}
86           # disable liveness probe when breakpoints set in debugger
87           # so K8s doesn't restart unresponsive container
88           {{- if eq .Values.liveness.enabled true }}
89           livenessProbe:
90             tcpSocket:
91               port: {{ .Values.service.secure.internalPort }}
92             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
93             periodSeconds: {{ .Values.liveness.periodSeconds }}
94           {{ end }}
95           readinessProbe:
96             httpGet:
97               scheme: "HTTPS"
98               path: {{ .Values.readiness.path }}
99               port: {{ .Values.service.secure.internalPort }}
100             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
101             periodSeconds: {{ .Values.readiness.periodSeconds }}
102           volumeMounts:
103           - name: {{ include "common.fullname" . }}-logs
104             mountPath: /opt/logs
105           - name: tls-info
106             mountPath: /opt/tls
107           env:
108             - name: CONSUL_HOST
109               value: consul.{{ include "common.namespace" . }}
110             - name: USE_HTTPS
111               value: "1"
112             - name: HTTPS_CERT_PATH
113               value: "/opt/tls/cert.pem"
114             - name: HTTPS_KEY_PATH
115               value: "/opt/tls/key.pem"
116         - name: {{ include "common.name" . }}-fb-onap
117           image: {{ include "repositoryGenerator.image.logging" . }}
118           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
119           volumeMounts:
120           - name: {{ include "common.fullname" . }}-fb-conf
121             mountPath: /usr/share/filebeat/filebeat.yml
122             subPath: filebeat.yml
123           - name: {{ include "common.fullname" . }}-data-fb
124             mountPath: /usr/share/filebeat/data
125           - name: {{ include "common.fullname" . }}-logs
126             mountPath: /var/log/onap/config-binding-service
127         {{ end }}
128         {{- if .Values.service.insecure.enabled }}
129         - name: {{ include "common.name" . }}-insecure
130           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
131           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
132           resources:
133 {{ include "common.resources" . | indent 12 }}
134           ports:
135           - containerPort: {{ .Values.service.insecure.internalPort }}
136           # disable liveness probe when breakpoints set in debugger
137           # so K8s doesn't restart unresponsive container
138           {{- if eq .Values.liveness.enabled true }}
139           livenessProbe:
140             tcpSocket:
141               port: {{ .Values.service.insecure.internalPort }}
142             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
143             periodSeconds: {{ .Values.liveness.periodSeconds }}
144           {{ end }}
145           readinessProbe:
146             httpGet:
147               scheme: "HTTP"
148               path: {{ .Values.readiness.path }}
149               port: {{ .Values.service.insecure.internalPort }}
150             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
151             periodSeconds: {{ .Values.readiness.periodSeconds }}
152           volumeMounts:
153           - name: {{ include "common.fullname" . }}-logs-i
154             mountPath: /opt/logs
155           env:
156             - name: CONSUL_HOST
157               value: consul.{{ include "common.namespace" . }}
158         - name: {{ include "common.name" . }}-fb-onap-i
159           image: {{ include "repositoryGenerator.image.logging" . }}
160           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
161           volumeMounts:
162           - name: {{ include "common.fullname" . }}-fb-conf
163             mountPath: /usr/share/filebeat/filebeat.yml
164             subPath: filebeat.yml
165           - name: {{ include "common.fullname" . }}-data-fb-i
166             mountPath: /usr/share/filebeat/data
167           - name: {{ include "common.fullname" . }}-logs-i
168             mountPath: /var/log/onap/config-binding-service
169         {{ end }}
170       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
171       volumes:
172         - name: {{ include "common.fullname" . }}-fb-conf
173           configMap:
174             name: {{ include "common.release" . }}-cbs-filebeat-configmap
175         {{- if .Values.service.secure.enabled }}
176         - name: {{ include "common.fullname" . }}-data-fb
177           emptyDir: {}
178         - name:  {{ include "common.fullname" . }}-logs
179           emptyDir: {}
180         - name: tls-info
181           emptyDir: {}
182         {{ end }}
183         {{- if .Values.service.insecure.enabled }}
184         - name: {{ include "common.fullname" . }}-data-fb-i
185           emptyDir: {}
186         - name:  {{ include "common.fullname" . }}-logs-i
187           emptyDir: {}
188         {{ end }}
189
190       imagePullSecrets:
191       - name: "{{ include "common.namespace" . }}-docker-registry-key"