[GENERAL] Use readiness container v3.0.1
[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: apps/v1
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   selector:
26     matchLabels:
27       app: {{ include "common.name" . }}
28   replicas: {{ .Values.replicaCount }}
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}
33         release: {{ include "common.release" . }}
34     spec:
35       hostname: {{ .Values.global.dmaapDrProvName }}
36       initContainers:
37         - name: {{ include "common.name" . }}-readiness
38           image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
39           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40           command:
41           - /app/ready.py
42           args:
43           - --container-name
44           - {{ .Values.config.dmaapDrDb.mariadbContName }}
45           env:
46           - name: NAMESPACE
47             valueFrom:
48               fieldRef:
49                 apiVersion: v1
50                 fieldPath: metadata.namespace
51         {{- if .Values.global.aafEnabled }}
52
53         {{ include "common.certInitializer.initContainer" . | nindent 8 }}
54
55         - name: {{ include "common.name" . }}-permission-fixer
56           image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
57           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
59           command: ["chown","-Rf","1000:1001", "/opt/app/"]
60
61         {{ end }}
62       containers:
63         - name: {{ include "common.name" . }}
64           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
65           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66           ports:
67           - containerPort: {{ .Values.config.dmaapDrProv.internalPort }}
68           {{- if eq .Values.liveness.enabled true }}
69           livenessProbe:
70             tcpSocket:
71               port: {{ .Values.config.dmaapDrProv.internalPort }}
72             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
73             periodSeconds: {{ .Values.liveness.periodSeconds }}
74           {{ end -}}
75           readinessProbe:
76             tcpSocket:
77               port: {{ .Values.config.dmaapDrProv.internalPort }}
78             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
79             periodSeconds: {{ .Values.readiness.periodSeconds }}
80           env:
81           - name: DB_USERNAME
82             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "dmaap-dr-db-user-secret" "key" "login") | indent 12 }}
83           - name: DB_PASSWORD
84             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "dmaap-dr-db-user-secret" "key" "password") | indent 12 }}
85           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
86           - mountPath: /etc/localtime
87             name: localtime
88             readOnly: false
89           - mountPath: /opt/app/datartr/etc/provserver.properties
90             name: {{ include "common.fullname" . }}-config
91             subPath: provserver.properties
92           - mountPath: /opt/app/datartr/etc/logback.xml
93             name: {{ include "common.fullname" . }}-log-conf
94             subPath: logback.xml
95           - mountPath: {{ .Values.global.loggingDirectory }}
96             name: {{ include "common.fullname" . }}-logs
97           resources:
98 {{ include "common.resources" . }}
99         {{- if .Values.nodeSelector }}
100         nodeSelector:
101 {{ toYaml .Values.nodeSelector | indent 10 }}
102         {{- end -}}
103         {{- if .Values.affinity }}
104         affinity:
105 {{ toYaml .Values.affinity | indent 10 }}
106         {{- end -}}
107       # Filebeat sidecar container
108         - name: {{ include "common.name" . }}-filebeat-onap
109           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
110           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
111           volumeMounts:
112           - name: {{ include "common.fullname" . }}-filebeat-conf
113             mountPath: /usr/share/filebeat/filebeat.yml
114             subPath: filebeat.yml
115           - name: {{ include "common.fullname" . }}-data-filebeat
116             mountPath: /usr/share/filebeat/data
117           - name: {{ include "common.fullname" . }}-logs
118             mountPath: /var/log/onap/datarouter-prov
119       volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
120       - name: localtime
121         hostPath:
122           path: /etc/localtime
123       - name: {{ include "common.fullname" . }}-config
124         configMap:
125           name: {{ include "common.fullname" . }}-configmap
126           items:
127           - key: provserver.properties
128             path: provserver.properties
129       - name: {{ include "common.fullname" . }}-log-conf
130         configMap:
131           name: {{ include "common.fullname" . }}-log
132       - name: {{ include "common.fullname" . }}-filebeat-conf
133         configMap:
134           name: {{ include "common.fullname" . }}-dmaap-dr-prov-filebeat-configmap
135       - name: {{ include "common.fullname" . }}-data-filebeat
136         emptyDir: {}
137       - name:  {{ include "common.fullname" . }}-logs
138         emptyDir: {}
139       imagePullSecrets:
140       - name: "{{ include "common.namespace" . }}-docker-registry-key"