84d6bc1d472c8bf90b1414d84bf73d2560b61723
[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: {{- 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       initContainers:
27       - command:
28         - sh
29         args:
30         - -c
31         - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
32         env:
33         - name: DB_USER
34           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
35         - name: DB_PASSWORD
36           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
37         - name: HTTP_USER
38           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "http-user-creds" "key" "login") | indent 10 }}
39         - name: HTTP_PASSWORD
40           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "http-user-creds" "key" "password") | indent 10 }}
41         - name: HTTP_ADMIN_USER
42           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "admin-creds" "key" "login") | indent 10 }}
43         - name: HTTP_ADMIN_PASSWORD
44           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "admin-creds" "key" "password") | indent 10 }}
45         - name: HTTP_NODE_USER
46           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "node-creds" "key" "login") | indent 10 }}
47         - name: HTTP_NODE_PASSWORD
48           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "node-creds" "key" "password") | indent 10 }}
49         - name: REST_CONF_USER
50           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "login") | indent 10 }}
51         - name: REST_CONF_PASSWORD
52           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restconf-creds" "key" "password") | indent 10 }}
53         volumeMounts:
54         - mountPath: /config-input
55           name: config-input
56         - mountPath: /config
57           name: config
58         image: {{ include "repositoryGenerator.image.envsubst" . }}
59         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60         name: {{ include "common.name" . }}-update-config
61       - command:
62         - /app/ready.py
63         args:
64         - --app-name
65         - {{ .Values.config.dbPodName }}
66         env:
67         - name: NAMESPACE
68           valueFrom:
69             fieldRef:
70               apiVersion: v1
71               fieldPath: metadata.namespace
72         image: {{ include "repositoryGenerator.image.readiness" . }}
73         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
74         name: {{ include "common.name" . }}-readiness
75       containers:
76         - name: {{ include "common.name" . }}
77           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
78           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
79           command: ["/bin/bash"]
80           args: ["-c", "cd /opt/onap/ccsdk/dgbuilder/ && ./start.sh sdnc1.0 && wait"]
81           ports: {{- include "common.containerPorts" . | indent 10 }}
82           readinessProbe:
83             tcpSocket:
84               port: {{ .Values.service.internalPort }}
85             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
86             periodSeconds: {{ .Values.readiness.periodSeconds }}
87           env:
88           - name: SDNC_CONFIG_DIR
89             value: /opt/onap/sdnc/data/properties
90           volumeMounts:
91           - mountPath: /etc/localtime
92             name: localtime
93             readOnly: true
94           - name: config
95             mountPath: /opt/app/application.properties
96             subPath: application.properties
97           - name: config
98             mountPath: /opt/onap/ccsdk/dgbuilder/releases/sdnc1.0/conf/svclogic.properties
99             subPath: svclogic.properties
100           - name: config
101             mountPath: /opt/onap/ccsdk/dgbuilder/svclogic/svclogic.properties
102             subPath: svclogic.properties
103           - name: config
104             mountPath: /opt/onap/ccsdk/dgbuilder/releases/sdnc1.0/customSettings.js
105             subPath: customSettings.js
106           resources: {{ include "common.resources" . | nindent 12 }}
107         {{- if .Values.nodeSelector }}
108         nodeSelector:
109 {{ toYaml .Values.nodeSelector | indent 10 }}
110         {{- end -}}
111         {{- if .Values.affinity }}
112         affinity:
113 {{ toYaml .Values.affinity | indent 10 }}
114         {{- end }}
115       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
116       volumes:
117         - name: localtime
118           hostPath:
119             path: /etc/localtime
120         - name: config-input
121           configMap:
122             name: {{ include "common.fullname" . }}-config
123         - name: config
124           emptyDir:
125             medium: Memory
126       imagePullSecrets:
127       - name: "{{ include "common.namespace" . }}-docker-registry-key"