Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[oom.git] / kubernetes / common / dgbuilder / templates / deployment.yaml
1 {{/*
2 # Copyright © 2018 AT&T, 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:
20   name: {{ include "common.fullname" . }}
21   namespace: {{ include "common.namespace" . }}
22   labels:
23     app: {{ include "common.name" . }}
24     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
25     release: {{ include "common.release" . }}
26     heritage: {{ .Release.Service }}
27 spec:
28   replicas: {{ .Values.replicaCount }}
29   selector:
30     matchLabels:
31       app: {{ include "common.name" . }}
32   template:
33     metadata:
34       labels:
35         app: {{ include "common.name" . }}
36         release: {{ include "common.release" . }}
37     spec:
38       initContainers:
39       - command:
40         - sh
41         args:
42         - -c
43         - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
44         env:
45         - name: DB_USER
46           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
47         - name: DB_PASSWORD
48           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
49         - name: HTTP_USER
50           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "http-user-creds" "key" "login") | indent 10 }}
51         - name: HTTP_PASSWORD
52           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "http-user-creds" "key" "password") | indent 10 }}
53         - name: HTTP_ADMIN_USER
54           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "admin-creds" "key" "login") | indent 10 }}
55         - name: HTTP_ADMIN_PASSWORD
56           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "admin-creds" "key" "password") | indent 10 }}
57         - name: HTTP_NODE_USER
58           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "node-creds" "key" "login") | indent 10 }}
59         - name: HTTP_NODE_PASSWORD
60           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "node-creds" "key" "password") | indent 10 }}
61         - name: REST_CONF_USER
62           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
63         - name: REST_CONF_PASSWORD
64           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
65         volumeMounts:
66         - mountPath: /config-input
67           name: config-input
68         - mountPath: /config
69           name: config
70         image: {{ include "repositoryGenerator.image.envsubst" . }}
71         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72         name: {{ include "common.name" . }}-update-config
73 {{ include "common.certInitializer.initContainer" . | indent 6 }}
74       - command:
75         - /app/ready.py
76         args:
77         - --container-name
78         - {{ .Values.config.dbPodName }}
79         env:
80         - name: NAMESPACE
81           valueFrom:
82             fieldRef:
83               apiVersion: v1
84               fieldPath: metadata.namespace
85         image: {{ include "repositoryGenerator.image.readiness" . }}
86         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
87         name: {{ include "common.name" . }}-readiness
88       containers:
89         - name: {{ include "common.name" . }}
90           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
91           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
92           command: ["/bin/bash"]
93           args: ["-c", "cd /opt/onap/ccsdk/dgbuilder/ && {{ if .Values.global.aafEnabled}} cp /opt/app/osaaf/local/node-*.pem certs && {{end}}./start.sh sdnc1.0 && wait"]
94           ports:
95           - containerPort: {{ .Values.service.internalPort }}
96           readinessProbe:
97             tcpSocket:
98               port: {{ .Values.service.internalPort }}
99             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
100             periodSeconds: {{ .Values.readiness.periodSeconds }}
101           env:
102           - name: SDNC_CONFIG_DIR
103             value: /opt/onap/sdnc/data/properties
104           volumeMounts:
105 {{ include "common.certInitializer.volumeMount" . | indent 10 }}
106           - mountPath: /etc/localtime
107             name: localtime
108             readOnly: true
109           - name: config
110             mountPath: /opt/app/application.properties
111             subPath: application.properties
112           - name: config
113             mountPath: /opt/onap/ccsdk/dgbuilder/releases/sdnc1.0/conf/svclogic.properties
114             subPath: svclogic.properties
115           - name: config
116             mountPath: /opt/onap/ccsdk/dgbuilder/svclogic/svclogic.properties
117             subPath: svclogic.properties
118           - name: config
119             mountPath: /opt/onap/ccsdk/dgbuilder/releases/sdnc1.0/customSettings.js
120             subPath: customSettings.js
121           resources:
122 {{ include "common.resources" . | indent 12 }}
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       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
132       volumes:
133 {{ include "common.certInitializer.volumes" . | nindent 8 }}
134         - name: localtime
135           hostPath:
136             path: /etc/localtime
137         - name: config-input
138           configMap:
139             name: {{ include "common.fullname" . }}-config
140         - name: config
141           emptyDir:
142             medium: Memory
143       imagePullSecrets:
144       - name: "{{ include "common.namespace" . }}-docker-registry-key"