MetalLB install script for bare metal cluster
[oom.git] / kubernetes / sdnc / charts / sdnc-portal / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ include "common.release" . }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ include "common.release" . }}
32     spec:
33       initContainers:
34       - command:
35         - sh
36         args:
37         - -c
38         - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
39         env:
40         - name: SDNC_DB_USER
41           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
42         - name: SDNC_DB_PASSWORD
43           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
44         - name: DB_FABRIC_USER
45           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "fabric-db-creds" "key" "login") | indent 10 }}
46         - name: DB_FABRIC_PASSWORD
47           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "fabric-db-creds" "key" "password") | indent 10 }}
48         - name: ODL_USER
49           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "odl-creds" "key" "login") | indent 10 }}
50         - name: ODL_PASSWORD
51           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "odl-creds" "key" "password") | indent 10 }}
52         - name: KEYSTORE_PASSWORD
53           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "keystore-password" "key" "password") | indent 10 }}
54         volumeMounts:
55         - mountPath: /config-input
56           name: config-input
57         - mountPath: /config
58           name: properties
59         image: "{{ .Values.global.envsubstImage }}"
60         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
61         name: {{ include "common.name" . }}-update-config
62
63       - command:
64         - /root/ready.py
65         args:
66         - --container-name
67         - {{ include "common.mariadbService" . }}
68         - --container-name
69         - {{ .Values.config.sdncChartName }}
70         env:
71         - name: NAMESPACE
72           valueFrom:
73             fieldRef:
74               apiVersion: v1
75               fieldPath: metadata.namespace
76         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
77         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78         name: {{ include "common.name" . }}-readiness
79       containers:
80         - name: {{ include "common.name" . }}
81           command: ["/bin/bash"]
82           args: ["-c", "cd /opt/onap/sdnc/admportal/shell && ./start_portal.sh"]
83           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
84           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
85           ports:
86           - containerPort: {{ .Values.service.internalPort }}
87           # disable liveness probe when breakpoints set in debugger
88           # so K8s doesn't restart unresponsive container
89           {{ if .Values.liveness.enabled }}
90           livenessProbe:
91             tcpSocket:
92               port: {{ .Values.service.internalPort }}
93             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
94             periodSeconds: {{ .Values.liveness.periodSeconds }}
95           {{ end }}
96           readinessProbe:
97             tcpSocket:
98               port: {{ .Values.service.internalPort }}
99             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
100             periodSeconds: {{ .Values.readiness.periodSeconds }}
101           env:
102             - name: MYSQL_ROOT_PASSWORD
103               {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-root-password" "key" "password") | indent 14 }}
104             - name: SDNC_CONFIG_DIR
105               value: "{{ .Values.config.configDir }}"
106           volumeMounts:
107           - mountPath: /etc/localtime
108             name: localtime
109             readOnly: true
110           - mountPath: {{ .Values.config.configDir }}/admportal.json
111             name: properties
112             subPath: admportal.json
113           - mountPath: {{ .Values.config.configDir }}/dblib.properties
114             name: properties
115             subPath: dblib.properties
116           - mountPath: {{ .Values.config.configDir }}/svclogic.properties
117             name: properties
118             subPath: svclogic.properties
119           - mountPath: {{ .Values.config.configDir }}/svclogic.properties.sdnctldb01
120             name: properties
121             subPath: svclogic.properties
122           - mountPath: {{ .Values.config.configDir }}/svclogic.properties.sdnctldb02
123             name: properties
124             subPath: svclogic.properties.sdnctldb02
125           resources:
126 {{ include "common.resources" . | indent 12 }}
127         {{- if .Values.nodeSelector }}
128         nodeSelector:
129 {{ toYaml .Values.nodeSelector | indent 10 }}
130         {{- end -}}
131         {{- if .Values.affinity }}
132         affinity:
133 {{ toYaml .Values.affinity | indent 10 }}
134         {{- end }}
135       volumes:
136         - name: localtime
137           hostPath:
138             path: /etc/localtime
139         - name: config-input
140           configMap:
141             name: {{ include "common.fullname" . }}
142             defaultMode: 0644
143         - name: properties
144           emptyDir:
145             medium: Memory
146       imagePullSecrets:
147       - name: "{{ include "common.namespace" . }}-docker-registry-key"