Merge "[Portal] Adjust Pods Requests/Limits"
[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: {{ .Release.Name }}
23     heritage: {{ .Release.Service }}
24 spec:
25   replicas: {{ .Values.replicaCount }}
26   template:
27     metadata:
28       labels:
29         app: {{ include "common.name" . }}
30         release: {{ .Release.Name }}
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" . }}-dr-prov-aaf-config
50           image: "{{ include "common.repository" . }}/{{ .Values.global.aafAgentImage }}"
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           command: ["bash","-c","exec /opt/app/aaf_config/bin/agent.sh"]
53           volumeMounts:
54           - mountPath: {{ .Values.persistence.aafCredsPath }}
55             name: {{ include "common.fullname" . }}-aaf-config-vol
56           env:
57             - name: APP_FQI
58               value: "{{ .Values.aafConfig.fqi }}"
59             - name: aaf_locate_url
60               value: "https://aaf-locate.{{ .Release.Namespace }}:8095"
61             - name: aaf_locator_container
62               value: "{{ .Values.global.aafLocatorContainer }}"
63             - name: aaf_locator_container_ns
64               value: "{{ .Release.Namespace }}"
65             - name: aaf_locator_fqdn
66               value: "{{ .Values.aafConfig.fqdn }}"
67             - name: aaf_locator_public_fqdn
68               value: "{{.Values.aafConfig.publicFqdn}}"
69             - name: aaf_locator_app_ns
70               value: "{{ .Values.global.aafAppNs }}"
71             - name: DEPLOY_FQI
72               value: "{{ .Values.aafConfig.aafDeployFqi }}"
73             - name: DEPLOY_PASSWORD
74               value: "{{ .Values.aafConfig.aafDeployPass }}"
75             - name: cadi_longitude
76               value: "{{ .Values.aafConfig.cadiLongitude }}"
77             - name: cadi_latitude
78               value: "{{ .Values.aafConfig.cadiLatitude }}"
79         - name: {{ include "common.name" . }}-permission-fixer
80           image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
81           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
82           volumeMounts:
83           - mountPath: {{ .Values.persistence.aafCredsPath }}
84             name: {{ include "common.fullname" . }}-aaf-config-vol
85           command: ["chown","-Rf","1000:1001", "/opt/app/"]
86         {{ end }}
87       containers:
88         - name: {{ include "common.name" . }}
89           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
90           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
91           ports:
92           - containerPort: {{ .Values.config.dmaapDrProv.internalPort }}
93           {{- if eq .Values.liveness.enabled true }}
94           livenessProbe:
95             tcpSocket:
96               port: {{ .Values.config.dmaapDrProv.internalPort }}
97             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
98             periodSeconds: {{ .Values.liveness.periodSeconds }}
99           {{ end -}}
100           readinessProbe:
101             tcpSocket:
102               port: {{ .Values.config.dmaapDrProv.internalPort }}
103             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
104             periodSeconds: {{ .Values.readiness.periodSeconds }}
105           volumeMounts:
106           {{- if .Values.global.aafEnabled }}
107           - mountPath: {{ .Values.persistence.aafCredsPath }}
108             name: {{ include "common.fullname" . }}-aaf-config-vol
109           {{- end }}
110           - mountPath: /etc/localtime
111             name: localtime
112             readOnly: false
113           - mountPath: /opt/app/datartr/etc/provserver.properties
114             name: {{ include "common.fullname" . }}-config
115             subPath: provserver.properties
116           - mountPath: /opt/app/datartr/etc/logback.xml
117             name: {{ include "common.fullname" . }}-log-conf
118             subPath: logback.xml
119           - mountPath: {{ .Values.global.loggingDirectory }}
120             name: {{ include "common.fullname" . }}-logs
121           resources:
122 {{ include "common.resources" . }}
123         {{- if .Values.nodeSelector }}
124         nodeSelector:
125 {{ toYaml .Values.nodeSelector | indent 10 }}
126         {{- end -}}
127         {{- if .Values.affinity }}
128         affinity:
129 {{ toYaml .Values.affinity | indent 10 }}
130         {{- end -}}
131       # Filebeat sidecar container
132         - name: {{ include "common.name" . }}-filebeat-onap
133           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
134           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
135           volumeMounts:
136           - name: {{ include "common.fullname" . }}-filebeat-conf
137             mountPath: /usr/share/filebeat/filebeat.yml
138             subPath: filebeat.yml
139           - name: {{ include "common.fullname" . }}-data-filebeat
140             mountPath: /usr/share/filebeat/data
141           - name: {{ include "common.fullname" . }}-logs
142             mountPath: /var/log/onap/datarouter-prov
143       volumes:
144       - name: localtime
145         hostPath:
146           path: /etc/localtime
147       - name: {{ include "common.fullname" . }}-config
148         configMap:
149           name: {{ include "common.fullname" . }}-configmap
150           items:
151           - key: provserver.properties
152             path: provserver.properties
153       - name: {{ include "common.fullname" . }}-log-conf
154         configMap:
155           name: {{ include "common.fullname" . }}-log
156       - name: {{ include "common.fullname" . }}-filebeat-conf
157         configMap:
158           name: {{ include "common.fullname" . }}-dmaap-dr-prov-filebeat-configmap
159       - name: {{ include "common.fullname" . }}-data-filebeat
160         emptyDir: {}
161       - name:  {{ include "common.fullname" . }}-logs
162         emptyDir: {}
163       {{- if .Values.global.aafEnabled }}
164       - name: {{ include "common.fullname" . }}-aaf-config-vol
165         persistentVolumeClaim:
166           claimName: {{ include "common.fullname" . }}-aaf-props
167       {{ end }}
168       imagePullSecrets:
169       - name: "{{ include "common.namespace" . }}-docker-registry-key"