Merge "[SDNC] Add missing inclusion of common secret template"
[oom.git] / kubernetes / dmaap / components / dmaap-dr-prov / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 apiVersion: extensions/v1beta1
15 kind: Deployment
16 metadata:
17   name: {{ include "common.fullname" . }}
18   namespace: {{ include "common.namespace" . }}
19   labels:
20     app: {{ include "common.name" . }}
21     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
22     release: {{ include "common.release" . }}
23     heritage: {{ .Release.Service }}
24 spec:
25   replicas: {{ .Values.replicaCount }}
26   template:
27     metadata:
28       labels:
29         app: {{ include "common.name" . }}
30         release: {{ include "common.release" . }}
31     spec:
32       hostname: {{ .Values.global.dmaapDrProvName }}
33       initContainers:
34         - name: {{ include "common.name" . }}-readiness
35           image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
36           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
37           command:
38           - /root/ready.py
39           args:
40           - --container-name
41           - {{ .Values.config.dmaapDrDb.mariadbContName }}
42           env:
43           - name: NAMESPACE
44             valueFrom:
45               fieldRef:
46                 apiVersion: v1
47                 fieldPath: metadata.namespace
48         {{- if .Values.global.aafEnabled }}
49         - name: {{ include "common.name" . }}-aaf-readiness
50           image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           command:
53           - /root/ready.py
54           args:
55           - --container-name
56           - aaf-locate
57           - --container-name
58           - aaf-cm
59           - --container-name
60           - aaf-service
61           env:
62           - name: NAMESPACE
63             valueFrom:
64               fieldRef:
65                 apiVersion: v1
66                 fieldPath: metadata.namespace
67         - name: {{ include "common.name" . }}-dr-prov-aaf-config
68           image: "{{ include "common.repository" . }}/{{ .Values.global.aafAgentImage }}"
69           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
70           command: ["bash","-c","exec /opt/app/aaf_config/bin/agent.sh"]
71           volumeMounts:
72           - mountPath: {{ .Values.persistence.aafCredsPath }}
73             name: {{ include "common.fullname" . }}-aaf-config-vol
74           env:
75             - name: APP_FQI
76               value: "{{ .Values.aafConfig.fqi }}"
77             - name: aaf_locate_url
78               value: "https://aaf-locate.{{ .Release.Namespace }}:8095"
79             - name: aaf_locator_container
80               value: "{{ .Values.global.aafLocatorContainer }}"
81             - name: aaf_locator_container_ns
82               value: "{{ .Release.Namespace }}"
83             - name: aaf_locator_fqdn
84               value: "{{ .Values.aafConfig.fqdn }}"
85             - name: aaf_locator_public_fqdn
86               value: "{{.Values.aafConfig.publicFqdn}}"
87             - name: aaf_locator_app_ns
88               value: "{{ .Values.global.aafAppNs }}"
89             - name: DEPLOY_FQI
90               value: "{{ .Values.aafConfig.aafDeployFqi }}"
91             - name: DEPLOY_PASSWORD
92               value: "{{ .Values.aafConfig.aafDeployPass }}"
93             - name: cadi_longitude
94               value: "{{ .Values.aafConfig.cadiLongitude }}"
95             - name: cadi_latitude
96               value: "{{ .Values.aafConfig.cadiLatitude }}"
97         - name: {{ include "common.name" . }}-permission-fixer
98           image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
99           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
100           volumeMounts:
101           - mountPath: {{ .Values.persistence.aafCredsPath }}
102             name: {{ include "common.fullname" . }}-aaf-config-vol
103           command: ["chown","-Rf","1000:1001", "/opt/app/"]
104         {{ end }}
105       containers:
106         - name: {{ include "common.name" . }}
107           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
108           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
109           ports:
110           - containerPort: {{ .Values.config.dmaapDrProv.internalPort }}
111           {{- if eq .Values.liveness.enabled true }}
112           livenessProbe:
113             tcpSocket:
114               port: {{ .Values.config.dmaapDrProv.internalPort }}
115             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
116             periodSeconds: {{ .Values.liveness.periodSeconds }}
117           {{ end -}}
118           readinessProbe:
119             tcpSocket:
120               port: {{ .Values.config.dmaapDrProv.internalPort }}
121             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
122             periodSeconds: {{ .Values.readiness.periodSeconds }}
123           volumeMounts:
124           {{- if .Values.global.aafEnabled }}
125           - mountPath: {{ .Values.persistence.aafCredsPath }}
126             name: {{ include "common.fullname" . }}-aaf-config-vol
127           {{- end }}
128           - mountPath: /etc/localtime
129             name: localtime
130             readOnly: false
131           - mountPath: /opt/app/datartr/etc/provserver.properties
132             name: {{ include "common.fullname" . }}-config
133             subPath: provserver.properties
134           - mountPath: /opt/app/datartr/etc/logback.xml
135             name: {{ include "common.fullname" . }}-log-conf
136             subPath: logback.xml
137           - mountPath: {{ .Values.global.loggingDirectory }}
138             name: {{ include "common.fullname" . }}-logs
139           resources:
140 {{ include "common.resources" . }}
141         {{- if .Values.nodeSelector }}
142         nodeSelector:
143 {{ toYaml .Values.nodeSelector | indent 10 }}
144         {{- end -}}
145         {{- if .Values.affinity }}
146         affinity:
147 {{ toYaml .Values.affinity | indent 10 }}
148         {{- end -}}
149       # Filebeat sidecar container
150         - name: {{ include "common.name" . }}-filebeat-onap
151           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
152           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
153           volumeMounts:
154           - name: {{ include "common.fullname" . }}-filebeat-conf
155             mountPath: /usr/share/filebeat/filebeat.yml
156             subPath: filebeat.yml
157           - name: {{ include "common.fullname" . }}-data-filebeat
158             mountPath: /usr/share/filebeat/data
159           - name: {{ include "common.fullname" . }}-logs
160             mountPath: /var/log/onap/datarouter-prov
161       volumes:
162       - name: localtime
163         hostPath:
164           path: /etc/localtime
165       - name: {{ include "common.fullname" . }}-config
166         configMap:
167           name: {{ include "common.fullname" . }}-configmap
168           items:
169           - key: provserver.properties
170             path: provserver.properties
171       - name: {{ include "common.fullname" . }}-log-conf
172         configMap:
173           name: {{ include "common.fullname" . }}-log
174       - name: {{ include "common.fullname" . }}-filebeat-conf
175         configMap:
176           name: {{ include "common.fullname" . }}-dmaap-dr-prov-filebeat-configmap
177       - name: {{ include "common.fullname" . }}-data-filebeat
178         emptyDir: {}
179       - name:  {{ include "common.fullname" . }}-logs
180         emptyDir: {}
181       {{- if .Values.global.aafEnabled }}
182       - name: {{ include "common.fullname" . }}-aaf-config-vol
183         {{- if .Values.persistence.enabled }}
184         persistentVolumeClaim:
185           claimName: {{ include "common.fullname" . }}-aaf-props
186         {{- else }}
187         emptyDir: {}
188         {{- end }}
189       {{- end }}
190       imagePullSecrets:
191       - name: "{{ include "common.namespace" . }}-docker-registry-key"