a7362f23e68830cb1080775b1b157530cfaad222
[oom.git] / kubernetes / dmaap / components / dmaap-bc / templates / deployment.yaml
1 {{/*
2 # Modifications Copyright © 2018 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
17 apiVersion: apps/v1
18 kind: Deployment
19 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
20 spec:
21   selector: {{- include "common.selectors" . | nindent 4 }}
22   replicas: {{ .Values.replicaCount }}
23   template:
24     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
25     spec:
26       {{ include "common.podSecurityContext" . | indent 6 | trim}}
27       initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
28       {{- if .Values.usePostgres }}
29       - command:
30         - sh
31         args:
32         - -c
33         - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
34         env:
35           - name: PG_USER
36             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 12 }}
37           - name: PG_PASSWORD
38             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 12 }}
39         volumeMounts:
40           - mountPath: /config-input
41             name: {{ include "common.name" . }}-config-input
42           - mountPath: /config
43             name: {{ include "common.name" . }}-config
44         name: {{ include "common.name" . }}-update-config
45         image: {{ include "repositoryGenerator.image.envsubst" . }}
46         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47       - command:
48         - /app/ready.py
49         args:
50         - --container-name
51         - {{ .Values.postgres.nameOverride }}
52         securityContext:
53           runAsUser: 100
54           runAsGroup: 65533
55         env:
56         - name: NAMESPACE
57           valueFrom:
58             fieldRef:
59               apiVersion: v1
60               fieldPath: metadata.namespace
61         name: {{ include "common.name" . }}-postgres-readiness
62         image: {{ include "repositoryGenerator.image.readiness" . }}
63         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64       {{- end }}
65       containers:
66         - name: {{ include "common.name" . }}
67           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
68           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69           ports: {{ include "common.containerPorts" . | nindent 10  }}
70           {{ if eq .Values.liveness.enabled true -}}
71           livenessProbe:
72             httpGet:
73               port: {{ .Values.liveness.port }}
74               path: /webapi/topics
75             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
76             periodSeconds: {{ .Values.liveness.periodSeconds }}
77           {{ end -}}
78           readinessProbe:
79             httpGet:
80               port: {{ .Values.readiness.port }}
81               path: /webapi/topics
82             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
83             periodSeconds: {{ .Values.readiness.periodSeconds }}
84           volumeMounts:
85           - mountPath: /etc/localtime
86             name: localtime
87             readOnly: true
88           - name: {{ include "common.name" . }}-config
89             mountPath: /opt/app/config/conf/
90           - mountPath: /opt/app/dmaapbc/etc/logback.xml
91             name: {{ include "common.fullname" . }}-log-conf
92             subPath: logback.xml
93           resources: {{ include "common.resources" . | nindent 12 }}
94         {{- if .Values.nodeSelector }}
95         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
96         {{- end -}}
97         {{- if .Values.affinity }}
98         affinity: {{ toYaml .Values.affinity | nindent 10 }}
99         {{- end }}
100       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
101       volumes:
102         - name: localtime
103           hostPath:
104             path: /etc/localtime
105         - name: {{ include "common.fullname" . }}-log-conf
106           configMap:
107             name: {{ include "common.fullname" . }}-log
108         {{- if .Values.usePostgres }}
109         - name: {{ include "common.name" . }}-config-input
110           configMap:
111             name: {{ include "common.fullname" . }}-config
112         - name: {{ include "common.name" . }}-config
113           emptyDir:
114             medium: Memory
115         {{- else }}
116         - name: {{ include "common.name" . }}-config
117           configMap:
118             name: {{ include "common.fullname" . }}-config
119         {{- end }}
120       imagePullSecrets:
121       - name: "{{ include "common.namespace" . }}-docker-registry-key"