Merge "[COMMON] new logConfiguration chart"
[oom.git] / kubernetes / sdnc / charts / sdnc-portal / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 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   selector:
29     matchLabels:
30       app: {{ include "common.name" . }}
31   replicas: {{ .Values.replicaCount }}
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: SDNC_DB_USER
46           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
47         - name: SDNC_DB_PASSWORD
48           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
49         - name: DB_FABRIC_USER
50           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "fabric-db-creds" "key" "login") | indent 10 }}
51         - name: DB_FABRIC_PASSWORD
52           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "fabric-db-creds" "key" "password") | indent 10 }}
53         - name: ODL_USER
54           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "login") | indent 10 }}
55         - name: ODL_PASSWORD
56           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "odl-creds" "key" "password") | indent 10 }}
57         - name: KEYSTORE_PASSWORD
58           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "keystore-password" "key" "password") | indent 10 }}
59         volumeMounts:
60         - mountPath: /config-input
61           name: config-input
62         - mountPath: /config
63           name: properties
64         image: "{{ .Values.global.envsubstImage }}"
65         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66         name: {{ include "common.name" . }}-update-config
67
68       - command:
69         - /root/ready.py
70         args:
71         - --container-name
72         - {{ include "common.mariadbService" . }}
73         - --container-name
74         - {{ .Values.config.sdncChartName }}
75         env:
76         - name: NAMESPACE
77           valueFrom:
78             fieldRef:
79               apiVersion: v1
80               fieldPath: metadata.namespace
81         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
82         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
83         name: {{ include "common.name" . }}-readiness
84       containers:
85         - name: {{ include "common.name" . }}
86           command: ["/bin/bash"]
87           args: ["-c", "cd /opt/onap/sdnc/admportal/shell && ./start_portal.sh"]
88           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
89           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
90           ports:
91           - containerPort: {{ .Values.service.internalPort }}
92           # disable liveness probe when breakpoints set in debugger
93           # so K8s doesn't restart unresponsive container
94           {{ if .Values.liveness.enabled }}
95           livenessProbe:
96             tcpSocket:
97               port: {{ .Values.service.internalPort }}
98             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
99             periodSeconds: {{ .Values.liveness.periodSeconds }}
100           {{ end }}
101           readinessProbe:
102             tcpSocket:
103               port: {{ .Values.service.internalPort }}
104             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
105             periodSeconds: {{ .Values.readiness.periodSeconds }}
106           env:
107             - name: MYSQL_ROOT_PASSWORD
108               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 14 }}
109             - name: SDNC_CONFIG_DIR
110               value: "{{ .Values.config.configDir }}"
111           volumeMounts:
112           - mountPath: /etc/localtime
113             name: localtime
114             readOnly: true
115           - mountPath: {{ .Values.config.configDir }}/admportal.json
116             name: properties
117             subPath: admportal.json
118           - mountPath: {{ .Values.config.configDir }}/dblib.properties
119             name: properties
120             subPath: dblib.properties
121           - mountPath: {{ .Values.config.configDir }}/svclogic.properties
122             name: properties
123             subPath: svclogic.properties
124           - mountPath: {{ .Values.config.configDir }}/svclogic.properties.sdnctldb01
125             name: properties
126             subPath: svclogic.properties
127           - mountPath: {{ .Values.config.configDir }}/svclogic.properties.sdnctldb02
128             name: properties
129             subPath: svclogic.properties.sdnctldb02
130           resources:
131 {{ include "common.resources" . | indent 12 }}
132         {{- if .Values.nodeSelector }}
133         nodeSelector:
134 {{ toYaml .Values.nodeSelector | indent 10 }}
135         {{- end -}}
136         {{- if .Values.affinity }}
137         affinity:
138 {{ toYaml .Values.affinity | indent 10 }}
139         {{- end }}
140       volumes:
141         - name: localtime
142           hostPath:
143             path: /etc/localtime
144         - name: config-input
145           configMap:
146             name: {{ include "common.fullname" . }}
147             defaultMode: 0644
148         - name: properties
149           emptyDir:
150             medium: Memory
151       imagePullSecrets:
152       - name: "{{ include "common.namespace" . }}-docker-registry-key"