337461fa38cd4f0bbbc0727decf5c858fa04e9d6
[oom.git] / kubernetes / dcaegen2 / components / dcae-cloudify-manager / templates / deployment.yaml
1 #============LICENSE_START========================================================
2 # ================================================================================
3 # Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved.
4 # Modifications Copyright © 2018 Amdocs, Bell Canada
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 apiVersion: apps/v1
20 kind: Deployment
21 metadata:
22   name: {{ include "common.fullname" . }}
23   namespace: {{ include "common.namespace" . }}
24   labels:
25     app: {{ include "common.name" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ include "common.release" . }}
28     heritage: {{ .Release.Service }}
29 spec:
30   replicas: 1
31   selector:
32     matchLabels:
33       app: {{ include "common.name" . }}
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ include "common.release" . }}
39     spec:
40       # host alias allows local 'cfy' command to use https and match
41       # the host name in the certificate
42       hostAliases:
43       - ip: "127.0.0.1"
44         hostnames:
45         - "dcae-cloudify-manager"
46       initContainers:
47       - name: {{ include "common.name" . }}-readiness
48         image: {{ include "common.repository" . }}/{{ .Values.global.readinessImage }}
49         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50         command:
51           - /app/ready.py
52         args:
53           - --container-name
54           - aaf-cm
55           - "-t"
56           - "15"
57         env:
58           - name: NAMESPACE
59             valueFrom:
60               fieldRef:
61                 apiVersion: v1
62                 fieldPath: metadata.namespace
63       - name: {{ include "common.name" . }}-multisite-init
64         image: {{ include "common.repository" . }}/{{ .Values.multisiteInitImage }}
65         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66         args:
67           - --namespace
68           - {{ include "common.namespace" . }}
69           - --configmap
70           - {{ .Values.multisiteConfigMapName }}
71       - name: init-tls
72         env:
73           - name: POD_IP
74             valueFrom:
75               fieldRef:
76                 apiVersion: v1
77                 fieldPath: status.podIP
78           - name: aaf_locator_fqdn
79             value: dcae
80         image: {{ .Values.global.tlsRepository }}/{{ .Values.global.tlsImage }}
81         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
82         resources: {}
83         volumeMounts:
84             - mountPath: /opt/app/osaaf
85               name: tls-info
86       {{- if .Values.persistence.enabled }}
87       - name: remove-lost-found
88         image: "{{ .Values.global.busyboxRepository }}/{{ .Values.global.busyboxImage }}"
89         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
90         volumeMounts:
91         - mountPath: /cfy-persist
92           name: cm-persistent
93         command:
94         - /bin/sh
95         args:
96         - -c
97         - "rm -rf '/cfy-persist/lost+found';"
98       {{- end }}
99       containers:
100         - name: {{ include "common.name" . }}
101           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
102           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
103           env:
104             - name: REQUESTS_CA_BUNDLE
105               value: "/opt/onap/certs/cacert.pem"
106           resources:
107 {{ include "common.resources" . | indent 12 }}
108           ports:
109           - containerPort: {{ .Values.service.internalPort }}
110           # disable liveness probe when breakpoints set in debugger
111           # so K8s doesn't restart unresponsive container
112           {{- if eq .Values.liveness.enabled true }}
113           livenessProbe:
114             tcpSocket:
115               port: {{ .Values.service.internalPort }}
116             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
117             periodSeconds: {{ .Values.liveness.periodSeconds }}
118           {{ end }}
119           readinessProbe:
120             exec:
121               command:
122               - /scripts/readiness-check.sh
123             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
124             periodSeconds: {{ .Values.readiness.periodSeconds }}
125           volumeMounts:
126           - mountPath: /opt/onap/config.txt
127             subPath: config.txt
128             name: {{ include "common.fullname" .}}-config
129             readOnly: true
130           - mountPath: /opt/onap/kube
131             name: {{ include "common.fullname" .}}-kubeconfig
132             readOnly: true
133           - mountPath: /secret
134             name: dcae-token
135             readOnly: true
136           - mountPath: /sys/fs/cgroup
137             name: {{ include "common.fullname" . }}-cgroup
138             readOnly: true
139           - mountPath: /etc/localtime
140             name: localtime
141             readOnly: true
142           - mountPath: /cfy-persist
143             name: cm-persistent
144           - mountPath: /opt/onap/certs
145             name: tls-info
146           - mountPath: /opt/onap/cm-secrets
147             name: cm-secrets
148             readOnly: true
149           securityContext:
150             privileged: True
151       volumes:
152         - name: {{ include "common.fullname" . }}-config
153           configMap:
154             name: {{ include "common.fullname" . }}-configmap
155         - name: {{ include "common.fullname" .}}-kubeconfig
156           configMap:
157             name: {{ .Values.multisiteConfigMapName }}
158         - name: dcae-token
159           secret:
160             secretName: dcae-token
161         - name: {{ include "common.fullname" . }}-cgroup
162           hostPath:
163             path: /sys/fs/cgroup
164         - name: localtime
165           hostPath:
166             path: /etc/localtime
167         - name: cm-persistent
168         {{- if .Values.persistence.enabled }}
169           persistentVolumeClaim:
170             claimName: {{ include "common.fullname" . }}-data
171         {{- else }}
172           emptyDir: {}
173         {{- end }}
174         - emptyDir: {}
175           name: tls-info
176         - name: cm-secrets
177           secret:
178             secretName: {{ include "common.secret.getSecretNameFast" (dict "global" . "uid" "cm-pass") }}
179       imagePullSecrets:
180       - name: "{{ include "common.namespace" . }}-docker-registry-key"