Merge "Fix SDNC DMAAP consumer properties in HELM charts"
[oom.git] / kubernetes / dmaap / components / dmaap-bc / templates / deployment.yaml
1 # Modifications Copyright © 2018 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
15 apiVersion: apps/v1
16 kind: Deployment
17 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
18 spec:
19   selector: {{- include "common.selectors" . | nindent 4 }}
20   replicas: {{ .Values.replicaCount }}
21   template:
22     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
23     spec:
24 {{- if or .Values.global.aafEnabled .Values.PG.enabled }}
25       initContainers:
26       - command:
27         - sh
28         args:
29         - -c
30         - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
31         env:
32         - name: PG_USER
33           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }}
34         - name: PG_PASSWORD
35           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }}
36         volumeMounts:
37         - mountPath: /config-input
38           name: {{ include "common.name" . }}-config-input
39         - mountPath: /config
40           name: {{ include "common.name" . }}-config
41         image: "{{ .Values.global.envsubstImage }}"
42         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43         name: {{ include "common.name" . }}-update-config
44
45 {{- if .Values.global.aafEnabled }}
46       - name: {{ include "common.name" . }}-aaf-readiness
47         command:
48         - /root/ready.py
49         args:
50         - --container-name
51         - aaf-locate
52         - --container-name
53         - aaf-cm
54         - --container-name
55         - aaf-service
56         env:
57         - name: NAMESPACE
58           valueFrom:
59             fieldRef:
60               apiVersion: v1
61               fieldPath: metadata.namespace
62         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
63         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64       - name: {{ include "common.name" . }}-aaf-config
65         image: "{{ include "common.repository" . }}/{{ .Values.global.aafAgentImage }}"
66         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67         command: ["bash","-c","exec /opt/app/aaf_config/bin/agent.sh"]
68         volumeMounts:
69         - mountPath: {{ .Values.persistence.aafCredsPath }}
70           name: {{ include "common.name" . }}-aaf-config-vol
71         env:
72         - name: APP_FQI
73           value: "{{ .Values.aafConfig.fqi }}"
74         - name: aaf_locate_url
75           value: "https://aaf-locate.{{ .Release.Namespace }}:8095"
76         - name: aaf_locator_container
77           value: "{{ .Values.global.aafLocatorContainer }}"
78         - name: aaf_locator_container_ns
79           value: "{{ .Release.Namespace }}"
80         - name: aaf_locator_fqdn
81           value: "{{ .Values.aafConfig.fqdn }}"
82         - name: aaf_locator_public_fqdn
83           value: "{{.Values.aafConfig.publicFqdn}}"
84         - name: aaf_locator_app_ns
85           value: "{{ .Values.global.aafAppNs }}"
86         - name: DEPLOY_FQI
87           value: "{{ .Values.aafConfig.aafDeployFqi }}"
88         - name: DEPLOY_PASSWORD
89           valueFrom:
90             secretKeyRef:
91               name: {{ include "common.fullname" . }}-secret
92               key: aaf-deploy-password
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.name" . }}-aaf-config-vol
103         command: ["chown","-Rf","1000:1001", "/opt/app/"]
104 #       See AAF-425 for explanation of why this is needed.
105 #       This artifact is provisioned in AAF for both pks12 and jks format and apparently
106 #       the cadi library is not using the jks password on the jks keystore.
107 #       So, this attempts to "fix" the credential property file until this is fixed properly.
108       - name: {{ include "common.name" . }}-cred-fixer
109         image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
110         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
111         volumeMounts:
112         - mountPath: {{ .Values.persistence.aafCredsPath }}
113           name: {{ include "common.name" . }}-aaf-config-vol
114         command: ["/bin/sh"]
115         args: [ "-c", "sed -i -e '/cadi_keystore_password=/d' -e '/cadi_keystore_password_jks/p' -e 's/cadi_keystore_password_jks/cadi_keystore_password/' -e 's/dmaap-bc.p12/dmaap-bc.jks/' /opt/app/osaaf/local/org.onap.dmaap-bc.cred.props" ]
116
117 {{- end }}
118 {{- if .Values.PG.enabled }}
119       - name: {{ include "common.name" . }}-postgres-readiness
120         command:
121         - /root/ready.py
122         args:
123         - --container-name
124         - {{ .Values.postgres.nameOverride }}
125         env:
126         - name: NAMESPACE
127           valueFrom:
128             fieldRef:
129               apiVersion: v1
130               fieldPath: metadata.namespace
131         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
132         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
133 {{- end }}
134 {{- end }}
135       containers:
136         - name: {{ include "common.name" . }}
137           image: "{{ .Values.repository }}/{{ .Values.image }}"
138           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
139           ports: {{ include "common.containerPorts" . | nindent 10  }}
140           {{ if eq .Values.liveness.enabled true -}}
141           livenessProbe:
142             httpGet:
143               port: {{ .Values.liveness.port }}
144               path: /webapi/topics
145               scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
146             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
147             periodSeconds: {{ .Values.liveness.periodSeconds }}
148           {{ end -}}
149           readinessProbe:
150             httpGet:
151               port: {{ .Values.readiness.port }}
152               path: /webapi/topics
153               scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
154             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
155             periodSeconds: {{ .Values.readiness.periodSeconds }}
156           volumeMounts:
157           - mountPath: /etc/localtime
158             name: localtime
159             readOnly: true
160           - mountPath: {{ .Values.persistence.aafCredsPath }}
161             name: {{ include "common.name" . }}-aaf-config-vol
162 # NOTE: on the following several configMaps, careful to include / at end
163 #       since there may be more than one file in each mountPath
164           - name: {{ include "common.name" . }}-config
165             mountPath: /opt/app/config/conf/
166           resources: {{ include "common.resources" . | nindent 12 }}
167         {{- if .Values.nodeSelector }}
168         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
169         {{- end -}}
170         {{- if .Values.affinity }}
171         affinity: {{ toYaml .Values.affinity | nindent 10 }}
172         {{- end }}
173       volumes:
174         - name: localtime
175           hostPath:
176             path: /etc/localtime
177         - name: {{ include "common.name" . }}-config-input
178           configMap:
179             name: {{ include "common.fullname" . }}-config
180         - name: {{ include "common.name" . }}-aaf-config-vol
181           emptyDir: {}
182         - name: {{ include "common.name" . }}-config
183           emptyDir:
184             medium: Memory
185       imagePullSecrets:
186       - name: "{{ include "common.namespace" . }}-docker-registry-key"