Merge "[UUI] Service Mesh Compliance for UUI"
[oom.git] / kubernetes / portal / components / portal-widget / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018 AT&T
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 */}}
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   selector:
30     matchLabels:
31       app: {{ include "common.name" . }}
32   replicas: {{ .Values.replicaCount }}
33   template:
34     metadata:
35       labels:
36         app: {{ include "common.name" . }}
37         release: {{ include "common.release" . }}
38     spec:
39       initContainers:
40       - name: {{ include "common.name" . }}-readiness
41         image: {{ include "repositoryGenerator.image.readiness" . }}
42         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43         command:
44         - /app/ready.py
45         args:
46         - --container-name
47         - "portal-db"
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54       - name: {{ include "common.name" . }}-portal-widget-config
55         image: {{ include "repositoryGenerator.image.envsubst" . }}
56         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
57         command:
58         - sh
59         args:
60         - "-c"
61         - |
62           cd /config-input && \
63           for PFILE in `ls -1 *.*`
64           do
65             envsubst <${PFILE} >/config/${PFILE}
66             chmod 0755 /config/${PFILE}
67           done
68         env:
69           - name: PORTAL_DB_USER
70             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-backend-db" "key" "login") | indent 12 }}
71           - name: PORTAL_DB_PASSWORD
72             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-backend-db" "key" "password") | indent 12 }}
73           - name: WIDGET_USER
74             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-widget" "key" "login") | indent 12 }}
75           - name: WIDGET_PASSWORD
76             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-widget" "key" "password") | indent 12 }}
77           - name: ACC_USER
78             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-account" "key" "login") | indent 12 }}
79           - name: ACC_PASSWORD
80             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "portal-account" "key" "password") | indent 12 }}
81           - name: JASYPT_ENC_KEY
82             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "jasypt-enc-key" "key" "password") | indent 12 }}
83         volumeMounts:
84         - mountPath: /config-input
85           name: properties-onapwidgetms-scrubbed
86         - mountPath: /config
87           name: properties-onapwidgetms
88       containers:
89       - name: {{ include "common.name" . }}
90         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
91         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
92         command:
93           - /start-wms.sh
94         ports:
95         - containerPort: {{ .Values.service.internalPort }}
96         {{- if eq .Values.liveness.enabled true }}
97         livenessProbe:
98           tcpSocket:
99             port: {{ .Values.service.internalPort }}
100           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
101           periodSeconds: {{ .Values.liveness.periodSeconds }}
102         {{ end -}}
103         readinessProbe:
104           tcpSocket:
105             port: {{ .Values.service.internalPort }}
106           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
107           periodSeconds: {{ .Values.readiness.periodSeconds }}
108         volumeMounts:
109         - mountPath: /etc/localtime
110           name: localtime
111           readOnly: true
112         - name: properties-onapwidgetms
113           mountPath: "/application.properties"
114           subPath: application.properties
115         - name: properties-onapwidgetms
116           mountPath: "/application.yml"
117           subPath: application.yml
118         resources:
119 {{ include "common.resources" . | indent 12 }}
120       {{- if .Values.nodeSelector }}
121       nodeSelector:
122 {{ toYaml .Values.nodeSelector | indent 10 }}
123       {{- end -}}
124       {{- if .Values.affinity }}
125       affinity:
126 {{ toYaml .Values.affinity | indent 10 }}
127       {{- end }}
128       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
129       volumes:
130         - name: localtime
131           hostPath:
132             path: /etc/localtime
133         - name: properties-onapwidgetms
134           emptyDir:
135             medium: Memory
136         - name: properties-onapwidgetms-scrubbed
137           configMap:
138             name: {{ include "common.fullname" . }}-onapwidgetms
139             defaultMode: 0755
140       imagePullSecrets:
141       - name: "{{ include "common.namespace" . }}-docker-registry-key"