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