171fc7c807b013cb9d109f0576a28d7f0b82147d
[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 # Copyright (c) 2021 J. F. Lucas.  All rights reserved.
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             - consul-server
51             - --container-name
52             - aaf-cm
53             - "-t"
54             - "15"
55           env:
56           - name: NAMESPACE
57             valueFrom:
58               fieldRef:
59                 apiVersion: v1
60                 fieldPath: metadata.namespace
61           - name: aaf_locator_fqdn
62             value: dcae
63         {{- if .Values.service.secure.enabled }}
64         - name: init-tls
65           env:
66           - name: POD_IP
67             valueFrom:
68               fieldRef:
69                 apiVersion: v1
70                 fieldPath: status.podIP
71           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.tlsImage }}
72           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
73           resources: {}
74           volumeMounts:
75             - mountPath: /opt/app/osaaf
76               name: tls-info
77         {{ end  }}
78       containers:
79         {{- if .Values.service.secure.enabled }}
80         - name: {{ include "common.name" . }}
81           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
82           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
83           resources:
84 {{ include "common.resources" . | indent 12 }}
85           ports:
86           - containerPort: {{ .Values.service.secure.internalPort }}
87           # disable liveness probe when breakpoints set in debugger
88           # so K8s doesn't restart unresponsive container
89           {{- if eq .Values.liveness.enabled true }}
90           livenessProbe:
91             tcpSocket:
92               port: {{ .Values.service.secure.internalPort }}
93             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
94             periodSeconds: {{ .Values.liveness.periodSeconds }}
95           {{ end }}
96           readinessProbe:
97             httpGet:
98               scheme: "HTTPS"
99               path: {{ .Values.readiness.path }}
100               port: {{ .Values.service.secure.internalPort }}
101             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
102             periodSeconds: {{ .Values.readiness.periodSeconds }}
103           volumeMounts:
104           - name: {{ include "common.fullname" . }}-logs
105             mountPath: /opt/logs
106           - name: tls-info
107             mountPath: /opt/tls
108           env:
109             - name: CONSUL_HOST
110               value: consul-server-ui.{{ include "common.namespace" . }}
111             - name: USE_HTTPS
112               value: "1"
113             - name: HTTPS_CERT_PATH
114               value: "/opt/tls/cert.pem"
115             - name: HTTPS_KEY_PATH
116               value: "/opt/tls/key.pem"
117         - name: {{ include "common.name" . }}-fb-onap
118           image: {{ include "repositoryGenerator.image.logging" . }}
119           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
120           volumeMounts:
121           - name: {{ include "common.fullname" . }}-fb-conf
122             mountPath: /usr/share/filebeat/filebeat.yml
123             subPath: filebeat.yml
124           - name: {{ include "common.fullname" . }}-data-fb
125             mountPath: /usr/share/filebeat/data
126           - name: {{ include "common.fullname" . }}-logs
127             mountPath: /var/log/onap/config-binding-service
128         {{ end }}
129         {{- if .Values.service.insecure.enabled }}
130         - name: {{ include "common.name" . }}-insecure
131           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
132           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
133           resources:
134 {{ include "common.resources" . | indent 12 }}
135           ports:
136           - containerPort: {{ .Values.service.insecure.internalPort }}
137           # disable liveness probe when breakpoints set in debugger
138           # so K8s doesn't restart unresponsive container
139           {{- if eq .Values.liveness.enabled true }}
140           livenessProbe:
141             tcpSocket:
142               port: {{ .Values.service.insecure.internalPort }}
143             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
144             periodSeconds: {{ .Values.liveness.periodSeconds }}
145           {{ end }}
146           readinessProbe:
147             httpGet:
148               scheme: "HTTP"
149               path: {{ .Values.readiness.path }}
150               port: {{ .Values.service.insecure.internalPort }}
151             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
152             periodSeconds: {{ .Values.readiness.periodSeconds }}
153           volumeMounts:
154           - name: {{ include "common.fullname" . }}-logs-i
155             mountPath: /opt/logs
156           env:
157             - name: CONSUL_HOST
158               value: consul-server-ui.{{ include "common.namespace" . }}
159         - name: {{ include "common.name" . }}-fb-onap-i
160           image: {{ include "repositoryGenerator.image.logging" . }}
161           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
162           volumeMounts:
163           - name: {{ include "common.fullname" . }}-fb-conf
164             mountPath: /usr/share/filebeat/filebeat.yml
165             subPath: filebeat.yml
166           - name: {{ include "common.fullname" . }}-data-fb-i
167             mountPath: /usr/share/filebeat/data
168           - name: {{ include "common.fullname" . }}-logs-i
169             mountPath: /var/log/onap/config-binding-service
170         {{ end }}
171       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
172       volumes:
173         - name: {{ include "common.fullname" . }}-fb-conf
174           configMap:
175             name: {{ include "common.release" . }}-cbs-filebeat-configmap
176         {{- if .Values.service.secure.enabled }}
177         - name: {{ include "common.fullname" . }}-data-fb
178           emptyDir: {}
179         - name:  {{ include "common.fullname" . }}-logs
180           emptyDir: {}
181         - name: tls-info
182           emptyDir: {}
183         {{ end }}
184         {{- if .Values.service.insecure.enabled }}
185         - name: {{ include "common.fullname" . }}-data-fb-i
186           emptyDir: {}
187         - name:  {{ include "common.fullname" . }}-logs-i
188           emptyDir: {}
189         {{ end }}
190
191       imagePullSecrets:
192       - name: "{{ include "common.namespace" . }}-docker-registry-key"