Vid Template alignment.
[oom.git] / kubernetes / vid / 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: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
32     spec:
33       initContainers:
34       - command:
35         - /root/job_complete.py
36         args:
37         - --job-name
38         - vid-config-galera
39         env:
40         - name: NAMESPACE
41           valueFrom:
42             fieldRef:
43               apiVersion: v1
44               fieldPath: metadata.namespace
45         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
46         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47         name: {{ include "common.name" . }}-readiness
48       containers:
49         - name: {{ include "common.name" . }}
50           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           lifecycle:
53             postStart:
54               exec:
55                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/usr/local/tomcat/webapps/vid/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
56           ports:
57           - containerPort: {{ .Values.service.internalPort }}
58           # disable liveness probe when breakpoints set in debugger
59           # so K8s doesn't restart unresponsive container
60           {{- if eq .Values.liveness.enabled true }}
61           livenessProbe:
62             tcpSocket:
63               port: {{ .Values.service.internalPort }}
64             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
65             periodSeconds: {{ .Values.liveness.periodSeconds }}
66           {{ end -}}
67           readinessProbe:
68             tcpSocket:
69               port: {{ .Values.service.internalPort }}
70             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
71             periodSeconds: {{ .Values.readiness.periodSeconds }}
72           env:
73             - name: ASDC_CLIENT_REST_HOST
74               value: sdc-be.{{ include "common.namespace" . }}
75             - name: ASDC_CLIENT_REST_AUTH
76               value: "{{ .Values.config.asdcclientrestauth }}"
77             - name: ASDC_CLIENT_REST_PORT
78               value: "{{ .Values.config.asdcclientrestport }}"
79             - name: VID_AAI_HOST
80               value: aai.{{ include "common.namespace" . }}
81             - name: VID_AAI_PORT
82               value: "{{ .Values.config.vidaaiport }}"
83             - name: VID_ECOMP_SHARED_CONTEXT_REST_URL
84               value: http://portal-app.{{ include "common.namespace" . }}:{{ .Values.config.onapport }}/ONAPPORTAL/context
85             - name: VID_MSO_SERVER_URL
86               value: http://so.{{ include "common.namespace" . }}:{{ .Values.config.msoport }}
87             - name: VID_MSO_PASS
88               value: "{{ .Values.config.vidmsopass }}"
89             - name: MSO_DME2_SERVER_URL
90               value: "{{ .Values.config.msodme2serverurl }}"
91             - name: MSO_DME2_ENABLED
92               value: {{ .Values.global.debugEnabled | default .Values.debugEnabled | quote }}
93             - name: VID_ECOMP_REDIRECT_URL
94               value: http://portal-app.{{ include "common.namespace" . }}:{{ .Values.config.onapport }}/ONAPPORTAL/login.htm
95             - name: VID_ECOMP_REST_URL
96               value: http://portal-app.{{ include "common.namespace" . }}:{{ .Values.config.onapport }}/ONAPPORTAL/auxapi
97             - name: VID_CONTACT_US_LINK
98               value: "{{ .Values.config.vidcontactuslink }}"
99             - name: VID_UEB_URL_LIST
100               value: message-router.{{ include "common.namespace" . }}
101             - name: VID_MYSQL_HOST
102               value: "{{ .Values.config.vidmysqlhost }}"
103             - name: VID_MYSQL_PORT
104               value: "{{ .Values.config.vidmysqlport }}"
105             - name: VID_MYSQL_DBNAME
106               value: "{{ .Values.config.vidmysqldbname }}"
107             - name: VID_MYSQL_USER
108               value: "{{ .Values.config.vidmysqluser }}"
109             - name: VID_MYSQL_PASS
110               value: "{{ .Values.config.vidmysqlpassword }}"
111               #valueFrom:
112               #  secretKeyRef: {name: {{ include "common.fullname" . }}, key: vid-password}
113             - name: VID_MYSQL_MAXCONNECTIONS
114               value: "{{ .Values.config.vidmysqlmaxconnections }}"
115           volumeMounts:
116           - mountPath: /etc/localtime
117             name: localtime
118             readOnly: true
119           - mountPath: /var/log/onap
120             name: vid-logs
121           - mountPath: /tmp/logback.xml
122             name: vid-logback
123             subPath: logback.xml
124           resources:
125 {{ toYaml .Values.resources | indent 12 }}
126         {{- if .Values.nodeSelector }}
127         nodeSelector:
128 {{ toYaml .Values.nodeSelector | indent 10 }}
129         {{- end -}}
130         {{- if .Values.affinity }}
131         affinity:
132 {{ toYaml .Values.affinity | indent 10 }}
133         {{- end }}
134       # side car containers
135         - name: filebeat-onap
136           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
137           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
138           volumeMounts:
139           - mountPath: /usr/share/filebeat/filebeat.yml
140             name: filebeat-conf
141             subPath: filebeat.yml
142           - mountPath: /var/log/onap
143             name: vid-logs
144           - mountPath: /usr/share/filebeat/data
145             name: vid-data-filebeat
146       volumes:
147         - name: localtime
148           hostPath:
149             path: /etc/localtime
150         - name: filebeat-conf
151           configMap:
152             name: {{ include "common.fullname" . }}-filebeat-configmap
153         - name: vid-logs
154           emptyDir: {}
155         - name: vid-data-filebeat
156           emptyDir: {}
157         - name: vid-logback
158           configMap:
159             name: {{ include "common.fullname" . }}-log-configmap
160       imagePullSecrets:
161       - name: "{{ include "common.namespace" . }}-docker-registry-key"
162