Merge "[DCAEMOD] Uses new tpls for repos / images"
[oom.git] / kubernetes / dmaap / components / dmaap-dr-prov / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
16 apiVersion: apps/v1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   replicas: {{ .Values.replicaCount }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ include "common.release" . }}
36     spec:
37       hostname: {{ .Values.global.dmaapDrProvName }}
38       initContainers:
39         - name: {{ include "common.name" . }}-readiness
40           image: {{ include "repositoryGenerator.image.readiness" . }}
41           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
42           command:
43           - /app/ready.py
44           args:
45           - --container-name
46           - {{ .Values.config.dmaapDrDb.mariadbContName }}
47           env:
48           - name: NAMESPACE
49             valueFrom:
50               fieldRef:
51                 apiVersion: v1
52                 fieldPath: metadata.namespace
53         {{- if .Values.global.aafEnabled }}
54
55         {{ include "common.certInitializer.initContainer" . | nindent 8 }}
56
57         - name: {{ include "common.name" . }}-permission-fixer
58           image: {{ include "repositoryGenerator.image.busybox" . }}
59           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
61           command: ["chown","-Rf","1000:1001", "/opt/app/"]
62
63         {{ end }}
64       containers:
65         - name: {{ include "common.name" . }}
66           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
67           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
68           ports:
69           - containerPort: {{ .Values.config.dmaapDrProv.internalPort }}
70           {{- if eq .Values.liveness.enabled true }}
71           livenessProbe:
72             tcpSocket:
73               port: {{ .Values.config.dmaapDrProv.internalPort }}
74             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
75             periodSeconds: {{ .Values.liveness.periodSeconds }}
76           {{ end -}}
77           readinessProbe:
78             tcpSocket:
79               port: {{ .Values.config.dmaapDrProv.internalPort }}
80             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
81             periodSeconds: {{ .Values.readiness.periodSeconds }}
82           env:
83           - name: DB_USERNAME
84             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "dmaap-dr-db-user-secret" "key" "login") | indent 12 }}
85           - name: DB_PASSWORD
86             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "dmaap-dr-db-user-secret" "key" "password") | indent 12 }}
87           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
88           - mountPath: /etc/localtime
89             name: localtime
90             readOnly: false
91           - mountPath: /opt/app/datartr/etc/provserver.properties
92             name: {{ include "common.fullname" . }}-config
93             subPath: provserver.properties
94           - mountPath: /opt/app/datartr/etc/logback.xml
95             name: {{ include "common.fullname" . }}-log-conf
96             subPath: logback.xml
97           - mountPath: {{ .Values.global.loggingDirectory }}
98             name: {{ include "common.fullname" . }}-logs
99           resources:
100 {{ include "common.resources" . }}
101         {{- if .Values.nodeSelector }}
102         nodeSelector:
103 {{ toYaml .Values.nodeSelector | indent 10 }}
104         {{- end -}}
105         {{- if .Values.affinity }}
106         affinity:
107 {{ toYaml .Values.affinity | indent 10 }}
108         {{- end -}}
109       # Filebeat sidecar container
110         - name: {{ include "common.name" . }}-filebeat-onap
111           image: {{ include "repositoryGenerator.image.logging" . }}
112           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
113           volumeMounts:
114           - name: {{ include "common.fullname" . }}-filebeat-conf
115             mountPath: /usr/share/filebeat/filebeat.yml
116             subPath: filebeat.yml
117           - name: {{ include "common.fullname" . }}-data-filebeat
118             mountPath: /usr/share/filebeat/data
119           - name: {{ include "common.fullname" . }}-logs
120             mountPath: /var/log/onap/datarouter-prov
121       volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
122       - name: localtime
123         hostPath:
124           path: /etc/localtime
125       - name: {{ include "common.fullname" . }}-config
126         configMap:
127           name: {{ include "common.fullname" . }}-configmap
128           items:
129           - key: provserver.properties
130             path: provserver.properties
131       - name: {{ include "common.fullname" . }}-log-conf
132         configMap:
133           name: {{ include "common.fullname" . }}-log
134       - name: {{ include "common.fullname" . }}-filebeat-conf
135         configMap:
136           name: {{ include "common.fullname" . }}-dmaap-dr-prov-filebeat-configmap
137       - name: {{ include "common.fullname" . }}-data-filebeat
138         emptyDir: {}
139       - name:  {{ include "common.fullname" . }}-logs
140         emptyDir: {}
141       imagePullSecrets:
142       - name: "{{ include "common.namespace" . }}-docker-registry-key"