Merge "Updated Cloud Guide with links to wiki"
[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/ready.py
36         args:
37         - --container-name
38         - {{ .Values.mariadb.nameOverride }}
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: "{{ .Values.global.repository | default .Values.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" . }}-sdc
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-service.{{ include "common.namespace" . }}-aai
81             - name: VID_AAI_PORT
82               value: "{{ .Values.config.vidaaiport }}"
83             - name: VID_ECOMP_SHARED_CONTEXT_REST_URL
84               value: http://portalapps.{{ include "common.namespace" . }}-portal:"{{ .Values.config.onapport }}"/ONAPPORTAL/context
85             - name: VID_MSO_SERVER_URL
86               value: http://mso.{{ include "common.namespace" . }}-mso:"{{ .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://portalapps.{{ include "common.namespace" . }}-portal:"{{ .Values.config.onapport }}"/ONAPPORTAL/login.h\tm
95             - name: VID_ECOMP_REST_URL
96               value: http://portalapps.{{ include "common.namespace" . }}-portal:"{{ .Values.config.onapport }}"/ONAPPORTAL/auxapi
97             - name: VID_CONTACT_US_LINK
98               value: "{{ .Values.config.vidcontactuslink }}"
99             - name: VID_UEB_URL_LIST
100               value: dmaap.{{ include "common.namespace" . }}-message-router
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               valueFrom:
111                 secretKeyRef:
112                   name: {{ template "common.fullname" . }}
113                   key: vid-password
114             - name: VID_MYSQL_MAXCONNECTIONS
115               value: "{{ .Values.config.vidmysqlmaxconnections }}"
116           volumeMounts:
117           - mountPath: /etc/localtime
118             name: localtime
119             readOnly: true
120           - mountPath: /var/log/onap
121             name: vid-logs
122           - mountPath: /tmp/logback.xml
123             name: vid-logback
124             subPath: logback.xml
125           resources:
126 {{ toYaml .Values.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       # side car containers
136         - name: filebeat-onap
137           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
138           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
139           volumeMounts:
140           - mountPath: /usr/share/filebeat/filebeat.yml
141             name: filebeat-conf
142             subPath: filebeat.yml
143           - mountPath: /var/log/onap
144             name: vid-logs
145           - mountPath: /usr/share/filebeat/data
146             name: vid-data-filebeat
147       volumes:
148         - name: localtime
149           hostPath:
150             path: /etc/localtime
151         - name: filebeat-conf
152           configMap:
153             name: {{ include "common.fullname" . }}-filebeat-configmap
154         - name: vid-logs
155           emptyDir: {}
156         - name: vid-data-filebeat
157           emptyDir: {}
158         - name: vid-logback
159           configMap:
160             name: {{ include "common.fullname" . }}-log-configmap
161       imagePullSecrets:
162       - name: "{{ include "common.namespace" . }}-docker-registry-key"