Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / sdnc / components / 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         - --service-name
65         - {{ .Values.config.dbServiceName }}
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         resources:
76           limits:
77             cpu: "100m"
78             memory: "500Mi"
79           requests:
80             cpu: "3m"
81             memory: "20Mi"
82       containers:
83         - name: {{ include "common.name" . }}
84           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
85           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
86           command: ["/bin/bash"]
87           args: ["-c", "cd /opt/onap/ccsdk/dgbuilder/ && ./start.sh sdnc1.0 && wait"]
88           ports: {{- include "common.containerPorts" . | indent 10 }}
89           readinessProbe:
90             tcpSocket:
91               port: {{ .Values.service.internalPort }}
92             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
93             periodSeconds: {{ .Values.readiness.periodSeconds }}
94           env:
95           - name: SDNC_CONFIG_DIR
96             value: /opt/onap/sdnc/data/properties
97           volumeMounts:
98           - name: config
99             mountPath: /opt/app/application.properties
100             subPath: application.properties
101           - name: config
102             mountPath: /opt/onap/ccsdk/dgbuilder/releases/sdnc1.0/conf/svclogic.properties
103             subPath: svclogic.properties
104           - name: config
105             mountPath: /opt/onap/ccsdk/dgbuilder/svclogic/svclogic.properties
106             subPath: svclogic.properties
107           - name: config
108             mountPath: /opt/onap/ccsdk/dgbuilder/releases/sdnc1.0/customSettings.js
109             subPath: customSettings.js
110           resources: {{ include "common.resources" . | nindent 12 }}
111         {{- if .Values.nodeSelector }}
112         nodeSelector:
113 {{ toYaml .Values.nodeSelector | indent 10 }}
114         {{- end -}}
115         {{- if .Values.affinity }}
116         affinity:
117 {{ toYaml .Values.affinity | indent 10 }}
118         {{- end }}
119       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
120       volumes:
121         - name: config-input
122           configMap:
123             name: {{ include "common.fullname" . }}-config
124         - name: config
125           emptyDir:
126             medium: Memory
127       {{- include "common.imagePullSecrets" . | nindent 6 }}