Merge "add nssmf adpter endpoint and so infra endpoint, update the oof endpoint"
[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
47 {{ include "common.certInitializer.initContainer" . | nindent 6 }}
48
49       - name: {{ include "common.name" . }}-permission-fixer
50         image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
51         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
53         command: ["chown","-Rf","1000:1001", "/opt/app/"]
54 #       See AAF-425 for explanation of why this is needed.
55 #       This artifact is provisioned in AAF for both pks12 and jks format and apparently
56 #       the cadi library is not using the jks password on the jks keystore.
57 #       So, this attempts to "fix" the credential property file until this is fixed properly.
58       - name: {{ include "common.name" . }}-cred-fixer
59         image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
60         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
61         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
62         command: ["/bin/sh"]
63         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" ]
64
65 {{- end }}
66 {{- if .Values.PG.enabled }}
67       - name: {{ include "common.name" . }}-postgres-readiness
68         command:
69         - /root/ready.py
70         args:
71         - --container-name
72         - {{ .Values.postgres.nameOverride }}
73         env:
74         - name: NAMESPACE
75           valueFrom:
76             fieldRef:
77               apiVersion: v1
78               fieldPath: metadata.namespace
79         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
80         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
81 {{- end }}
82 {{- end }}
83       containers:
84         - name: {{ include "common.name" . }}
85           image: "{{ .Values.repository }}/{{ .Values.image }}"
86           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
87           ports: {{ include "common.containerPorts" . | nindent 10  }}
88           {{ if eq .Values.liveness.enabled true -}}
89           livenessProbe:
90             httpGet:
91               port: {{ .Values.liveness.port }}
92               path: /webapi/topics
93               scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
94             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
95             periodSeconds: {{ .Values.liveness.periodSeconds }}
96           {{ end -}}
97           readinessProbe:
98             httpGet:
99               port: {{ .Values.readiness.port }}
100               path: /webapi/topics
101               scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
102             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
103             periodSeconds: {{ .Values.readiness.periodSeconds }}
104           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
105           - mountPath: /etc/localtime
106             name: localtime
107             readOnly: true
108 # NOTE: on the following several configMaps, careful to include / at end
109 #       since there may be more than one file in each mountPath
110           - name: {{ include "common.name" . }}-config
111             mountPath: /opt/app/config/conf/
112           resources: {{ include "common.resources" . | nindent 12 }}
113         {{- if .Values.nodeSelector }}
114         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
115         {{- end -}}
116         {{- if .Values.affinity }}
117         affinity: {{ toYaml .Values.affinity | nindent 10 }}
118         {{- end }}
119       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
120         - name: localtime
121           hostPath:
122             path: /etc/localtime
123         - name: {{ include "common.name" . }}-config-input
124           configMap:
125             name: {{ include "common.fullname" . }}-config
126         - name: {{ include "common.name" . }}-config
127           emptyDir:
128             medium: Memory
129       imagePullSecrets:
130       - name: "{{ include "common.namespace" . }}-docker-registry-key"